- Docs
- Tailwind
Flexilla - Tailwind Plugin
Simplified styling for Flexilla with variants and components
Introduction
The
@flexilla/tailwind-plugin
provides simplified variants and essential components for styling elements in the Flexilla library. Instead of writing verbose attribute-based styling like data-[state=open]:some-class
, this plugin introduces easy-to-use variants, such as fx-open:some-class
. Additionally, it includes predefined components like overlays, tab indicators, and animated modal content for quick implementation of common UI features. Installation
To get started, install the
@flexilla/tailwind-plugin
using npm or yarn: Then, include it in your TailwindCSS configuration:
Variants
The plugin offers a range of variants that allow you to conditionally style elements based on the
data-state
attribute. The variants are prefixed with fx-
to make the syntax concise and easy to use. Available State Variants
Here are the supported state variants:
-
fx-open
: data-state=open -
fx-closed
: data-state=closed -
fx-active
-
fx-inactive
-
fx-visible
-
fx-hidden
And their negations:
-
fx-not-open
-
fx-not-active
-
fx-not-visible
- and moreā¦
Example Usage
Instead of writing:
You can simply write:
The plugin also supports
peer-
and group-
variants, allowing you to target peer or grouped elements based on the same states: Components
The
@flexilla/tailwind-plugin
also includes essential UI components, each with predefined styles to speed up your development. Popper
The
ui-popper
component positions elements based on custom CSS variables: For an absolute positioned popper, use:
Animated Modal Content
The
ui-animated-modal-content
class adds required styles in can you need to add animation to the modal content Animated Tab Panel
Use the
ui-animated-tab-panel
same as ui-animated-modal-content
but for tabs transitions: Tabs Indicator
For styling tab indicators, use the
ui-tabs-indicator
class. It allows for dynamic positioning and sizing through CSS variables: Overlay
The
ui-overlay
provides a fixed overlay for modals or other UI elements: