Tailwindcss Logical screenshot

Tailwindcss Logical

Author Avatar Theme by Stevecochrane
Updated: 13 Mar 2025
186 Stars

A CSS Logical Properties and Values plugin for Tailwind CSS.

Overview:

The tailwindcss-logical plugin is designed to enhance Tailwind CSS by incorporating CSS Logical Properties and Values for easier development in non-LTR (left-to-right) languages. This plugin provides a solution to styling elements that need to adapt based on the reading direction of the language.

Features:

  • Flow-relative Values: for float, clear, text-align, and resize.
  • Logical Height and Logical Width: utilities for block-size, inline-size, min/max sizes.
  • Flow-relative Margins: utilities for margin properties according to reading direction.
  • Flow-relative Padding: utilities for padding properties based on reading direction.
  • Flow-relative Space Between: utilities for space between elements.
  • Flow-relative Offsets: utilities for inset properties.

Installation:

To install the tailwindcss-logical plugin, follow these steps:

  1. Add the plugin as a dependency in your project.

    npm install tailwindcss-logical
    
  2. Register tailwindcss-logical in the plugins section of your Tailwind CSS configuration file.

    Before Tailwind v3:

    module.exports = {
        plugins: [
            require('tailwindcss-logical'),
        ],
    }
    

    Note: In Tailwind v3, adding variants to variants.logical in the configuration file is no longer necessary.

Summary:

The tailwindcss-logical plugin extends Tailwind CSS to support CSS Logical Properties and Values, which simplifies styling elements for languages that are read right-to-left. By providing flow-relative values, margins, padding, and offsets, this plugin offers a more intuitive way to handle multi-directional layouts in web development. It complements Tailwind CSS v3 and above by integrating seamlessly with the existing utility classes.