- Docs
- UnoCSS
Flexilla UnoCSS Plugin
Simplified styling for Flexilla using UnoCSS with customizable state variants and components.
Introduction
The
"@flexilla/uno-preset
for UnoCSS provides simplified state-based variants and essential components, making styling easier and more efficient. By default, the state variants are prefixed with fx
, but this can be customized based on your needs. Instead of verbose attribute-based syntax like
data-[state=open]:some-class
, you can use concise, readable variants such as fx-open:some-class
. Additionally, it offers pre-defined components like overlays, tab indicators, and animated modal content. Installation
To get started, install the plugin using npm or yarn:
Include it in your UnoCSS configuration:
Customization
You can easily customize the prefix used for state variants by passing options to the plugin. For example, to change the prefix to
ui
: 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: