Skip to main content

Tailwind Variants

Mantle registers these Tailwind variants with @custom-variant in mantle.css.

Theme

VariantDescription
light:Applies a class when the light theme is active.
dark:Applies a class when the dark theme is active. Replaces Tailwind's built-in dark:: it matches the theme mantle applies (a .dark class or a data-theme attribute), not prefers-color-scheme.

Hover media queries

VariantDescription
hover-hover:Applies a class on a device that can hover, whether or not the pointer is over the element. Tailwind's hover: also needs the pointer on the element.
hover-none:Applies a class on a device that can't hover.

ARIA

VariantDescription
aria-collapsed:Matches elements with aria-expanded="false".
aria-invalid:Matches elements with aria-invalid="true".
aria-unchecked:Matches elements with aria-checked="false".

Data attribute: state

VariantDescription
data-state-active:Matches elements with data-state~=active.
data-state-checked:Matches elements with data-state~=checked.
data-state-closed:Matches elements with data-state~=closed.
data-state-idle:Matches elements with data-state~=idle.
data-state-inactive:Matches elements with data-state~=inactive.
data-state-indeterminate:Matches elements with data-state~=indeterminate.
data-state-open:Matches elements with data-state~=open.
data-state-pending:Matches elements with data-state~=pending.
data-state-selected:Matches elements with data-state~=selected.
data-state-submitting:Matches elements with data-state~=submitting.
data-state-unchecked:Matches elements with data-state~=unchecked.

Data attribute: orientation and side

VariantDescription
data-orientation-horizontal:Matches elements with data-orientation="horizontal".
data-orientation-vertical:Matches elements with data-orientation="vertical".
data-side-bottom:Matches elements with data-side="bottom".
data-side-left:Matches elements with data-side="left".
data-side-right:Matches elements with data-side="right".
data-side-top:Matches elements with data-side="top".

Data attribute: validation

VariantDescription
data-validation-error:Matches elements with data-validation="error".
data-validation-success:Matches elements with data-validation="success".
data-validation-warning:Matches elements with data-validation="warning".

Data attribute: other

VariantDescription
data-active-item:Matches elements with data-active-item~="true".
data-disabled:Matches elements with the data-disabled attribute.
data-drag-over:Matches elements with data-drag-over="true".
data-highlighted:Matches elements with the data-highlighted attribute.

Utility

VariantDescription
where:Wraps the selector in :where() to zero out specificity.

Live detection

The pills below show which variants are active in your browser:

  • pointer-coarse:
  • pointer-fine:
  • pointer-none:
  • hover-hover:
  • hover-none: