Type-safe CSS styling
This module provides a typed interface for generating CSS styles without writing raw CSS. It prevents typos and invalid combinations at compile-time by using OCaml's type system.
Core Concepts
- Utility-first: Instead of writing CSS classes with multiple properties, you compose small, single-purpose utilities (e.g.,
bg blue for background color, p 4 for padding)
- Type-safe: The OCaml compiler catches errors like misspelled utilities or invalid value combinations at compile time
- Composable: Styles are composed by creating lists of utilities that work together
How It Works
1. Each function returns a value of type t representing a single style 2. Multiple styles are combined by creating a t list 3. The list is converted to CSS using to_classes 4. The resulting string is used with HTML elements
Units and Scales
- Spacing: Integer values create spacing in 0.25rem increments.
4 = 1rem = 16px (by default) - Sizes: Predefined sizes like
sm, md, lg provide consistent scaling - Colors: Colors use an optional shade parameter (50-900) where higher numbers are darker
Usage Example
let button_classes =
to_classes
[
bg blue;
text white;
py 4;
px 8;
font_bold;
rounded_md;
hover [ bg ~shade:700 blue ];
transition_colors;
sm [ px 6 ];
]
Learn More
- The API design follows Tailwind CSS conventions
- Colors, spacing, and sizes use consistent scales throughout
CSS rule extraction — converts Tailwind utility classes into Output.t values.
Core Types
The abstract type representing a single CSS style utility.
Abstract type for colors. Use color constructors like red, blue, etc. Colors can have shades from 50 (lightest) to 900 (darkest).
Tailwind colors
Base colors map to the Tailwind v4 palette (shades 50–950). Use bg color shade, text color shade, and border_color color shade to produce utilities.
Palettes include: black, white, gray, slate, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose.
For the full palette and OKLCH values, see
Color Constructors
hex "#1da1f2" creates a custom color from a hex string. The # prefix is optional.
Examples:
hex "#1da1f2" - Twitter blue with # prefix.hex "ff5733" - Orange without # prefix.hex "#f0f" - 3-character hex codes are supported.
rgb r g b creates a custom color from RGB values (0-255).
Examples:
rgb 29 161 242 - Twitter bluergb 255 87 51 - Orange
Raises Invalid_argument if any channel value is outside 0-255 range.
Base Styles
Preflight
Preflight provides Tailwind’s base CSS reset. It is included automatically when generating full CSS with this library.
preflight ?theme ?placeholder_supports ?forms () returns Tailwind's Preflight base reset rules, reading the --default-* font tokens through theme (default Scheme.default).
Use this to compose the base reset manually when needed. When using to_css with ~base:true (the default), the base reset is already included.
If forms is true, omits webkit datetime rules that the forms plugin provides (display:inline-flex and fields-wrapper padding) to avoid duplicates.
Usage:
Css.stylesheet (preflight () |> List.map (fun r -> Css.Rule r))- Combine with
to_css output for a full stylesheet.
Layout
Aspect Ratio
aspect_auto sets automatic aspect ratio based on content or CSS rules.
aspect_square sets a square 1:1 aspect ratio.
aspect_video sets a 16:9 aspect ratio.
Sourceval aspect_ratio : int -> int -> t aspect_ratio w h maintains element proportions of w:h.
Columns
columns n sets column-count: n for multi-column layout.
columns_auto sets column-count: auto.
columns_3xs sets column-width to the --container-3xs size.
columns_2xs sets column-width to the --container-2xs size.
columns_xs sets column-width to the --container-xs size.
columns_sm sets column-width to the --container-sm size.
columns_md sets column-width to the --container-md size.
columns_lg sets column-width to the --container-lg size.
columns_xl sets column-width to the --container-xl size.
columns_2xl sets column-width to the --container-2xl size.
columns_3xl sets column-width to the --container-3xl size.
columns_4xl sets column-width to the --container-4xl size.
columns_5xl sets column-width to the --container-5xl size.
columns_6xl sets column-width to the --container-6xl size.
columns_7xl sets column-width to the --container-7xl size.
Break After
break_after_auto sets break-after: auto.
break_after_avoid sets break-after: avoid.
break_after_all sets break-after: all.
Sourceval break_after_avoid_page : t break_after_avoid_page sets break-after: avoid-page.
Sourceval break_after_page : t break_after_page sets break-after: page.
break_after_left sets break-after: left.
break_after_right sets break-after: right.
break_after_column sets break-after: column.
Break Before
break_before_auto sets break-before: auto.
break_before_avoid sets break-before: avoid.
break_before_all sets break-before: all.
Sourceval break_before_avoid_page : t break_before_avoid_page sets break-before: avoid-page.
Sourceval break_before_page : t break_before_page sets break-before: page.
break_before_left sets break-before: left.
break_before_right sets break-before: right.
break_before_column sets break-before: column.
Break Inside
break_inside_auto sets break-inside: auto.
break_inside_avoid sets break-inside: avoid.
Sourceval break_inside_avoid_page : t break_inside_avoid_page sets break-inside: avoid-page.
Sourceval break_inside_avoid_column : t break_inside_avoid_column sets break-inside: avoid-column.
Box Decoration Break
box_decoration_clone replicates the element's box decoration across fragment boxes.
box_decoration_slice slices the box decoration across fragment boxes.
Display
block makes the element a block; it takes full width and stacks vertically. Default for div, p, h1–h6.
inline makes the element inline; it flows with text and its width is based on content. Default for span, a, strong.
inline_block flows inline but can have width/height like a block.
table makes the element behave like a <table> element.
hidden completely hides the element; no space is reserved and screen readers skip it. Use sr_only to hide visually but keep accessible.
Float
float_left sets float: left.
float_right sets float: right.
float_none sets float: none.
float_start sets float: inline-start.
float_end sets float: inline-end.
Clear
clear_left clears left floats.
clear_right clears right floats.
clear_none does not clear floats.
clear_both clears floats on both sides.
clear_start clears inline-start floats.
clear_end clears inline-end floats.
Isolation
isolate creates a new stacking context to isolate z-index behavior. Useful to prevent z-index values from affecting elements outside this container.
Object Fit
object_contain scales image to fit container while preserving aspect ratio. The entire image will be visible but may have empty space.
object_cover scales image to cover the entire container while preserving aspect ratio. Parts of the image may be clipped to fill the container.
object_fill stretches image to fill container, ignoring aspect ratio. May cause distortion.
object_none keeps the image's original size; it may overflow or underflow the container.
object_scale_down scales down only if the image is larger than the container; otherwise uses the original size.
Object Position
object_top sets object position to top.
object_right sets object position to right.
object_bottom sets object position to bottom.
object_left sets object position to left.
object_center sets object position to center.
Overflow
overflow_auto uses automatic overflow handling.
overflow_hidden clips content that exceeds container bounds (no scrolling).
overflow_visible allows content to extend beyond container bounds (default).
overflow_scroll always shows scrollbars even if content fits.
overflow_x_auto uses automatic horizontal overflow.
overflow_x_hidden hides horizontal overflow.
overflow_x_visible shows horizontal overflow.
overflow_x_scroll always shows a horizontal scrollbar.
overflow_y_auto uses automatic vertical overflow.
overflow_y_hidden hides vertical overflow.
overflow_y_visible shows vertical overflow.
overflow_y_scroll always shows a vertical scrollbar.
overscroll_auto uses default scroll chaining behavior.
overscroll_contain prevents scroll chaining to parent elements.
overscroll_none prevents scroll chaining and overscroll effects.
overscroll_x_auto uses default horizontal overscroll behavior.
overscroll_x_contain prevents horizontal scroll chaining.
overscroll_x_none prevents horizontal scroll chaining and effects.
overscroll_y_auto uses default vertical overscroll behavior.
overscroll_y_contain prevents vertical scroll chaining.
overscroll_y_none prevents vertical scroll chaining and effects.
Overflow Wrap
wrap_normal uses default word wrapping behavior.
wrap_break_word breaks words to prevent overflow.
wrap_anywhere breaks at any character to prevent overflow.
Box Sizing
box_border includes borders and padding in the element's size.
Sourceval box_content : t box_content excludes borders and padding from the element's size.
Position
static uses normal document flow positioning. Ignores top/right/bottom/left properties.
relative positions relative to the element's normal position. You can use top/right/bottom/left to nudge from the original spot. Creates positioning context for absolute children.
absolute removes from normal flow and positions relative to the nearest positioned parent. Use with top/right/bottom/left for exact placement.
Example:
let badge_container = to_classes [ relative ]
let badge = to_classes [ absolute; top (-2); right (-2) ]
fixed is like absolute but relative to the viewport; it stays in place when scrolling.
sticky scrolls normally until it reaches a viewport edge, then sticks. Great for table headers and sidebars that follow scroll.
Top / Right / Bottom / Left
inset_0 sets all inset values to 0.
inset_x n sets horizontal inset (left and right).
inset_x' n is inset_x for a half-step scale value.
inset_x_0 sets left and right to 0.
inset_y n sets vertical inset (top and bottom).
inset_y' n is inset_y for a half-step scale value.
inset_y_0 sets top and bottom to 0.
top n sets top position value.
top' n is top for a half-step scale value (e.g. top' 0.5 for top-0.5).
right n sets right position value.
right' n is right for a half-step scale value.
bottom n sets bottom position value.
bottom' n is bottom for a half-step scale value.
left n sets left position value.
left' n is left for a half-step scale value.
inset n sets all position offsets (top, right, bottom, left) to the same value.
inset' n is inset for a half-step scale value.
top_1_2 positions the element at 50% from the top.
left_1_2 positions the element at 50% from the left.
Visibility
visible sets visibility: visible.
invisible sets visibility: hidden while preserving layout space.
collapse sets visibility: collapse.
Z-Index
z n controls stacking order - higher numbers appear on top.
Common values:
z 0: Default layerz 10: Dropdowns, tooltipsz 20: Modalsz 30: Notificationsz 40: Critical overlaysz 50: Maximum (use sparingly)
Negative values like z (-1) place elements behind others.
Flexbox & Grid
Flex Basis
basis_0 sets flex-basis to 0.
basis_1 sets flex-basis to 0.25rem.
basis_auto sets flex-basis to auto.
basis_full sets flex-basis to 100%.
Flex Direction
flex_row arranges flex items horizontally (left to right). This is the default for flex containers.
flex_row_reverse arranges flex items horizontally but reversed (right to left).
flex_col stacks flex items vertically (top to bottom). Changes the main axis to vertical.
flex_col_reverse stacks flex items vertically but reversed (bottom to top).
Flex Wrap
flex_wrap allows flex items to wrap onto multiple lines.
flex_wrap_reverse wraps flex items in reverse order.
flex_nowrap prevents flex items from wrapping.
Flex
flex creates a flex container for flexible layouts. Children can be arranged horizontally/vertically with gaps.
Example:
let nav_item = to_classes [ flex; items_center; gap 4 ]
inline_flex is like flex but the container itself is inline.
flex_1 item grows and shrinks as needed, ignoring initial size. Perfect for elements that should fill available space equally.
Example:
let columns = to_classes [ flex ]
let column = to_classes [ flex_1 ]
flex_auto item grows and shrinks but considers its content size. Good for text that should expand but not squish too much.
flex_initial item can shrink but will not grow beyond its content. Default flex behavior.
flex_none keeps the item at its natural size; it will not grow or shrink. Use for fixed-size elements like icons or buttons.
Flex Grow
flex_grow allows the flex item to grow.
flex_grow_0 prevents the flex item from growing.
Flex Shrink
flex_shrink allows the flex item to shrink.
flex_shrink_0 prevents the flex item from shrinking.
Order
order_first sets order to minimum value.
order_last sets order to maximum value.
order_none sets order to 0.
grid creates a grid container for 2D layouts with rows and columns. More structured than flexbox.
inline_grid is like grid but the container itself is inline.
Grid Template Columns
grid_cols n creates a grid with n equal columns.
grid_cols_none removes grid template columns.
grid_cols_subgrid uses subgrid for columns.
Grid Column
col_auto sets grid-column to auto.
col_span n makes element span n columns.
col_span_full spans all columns.
col_start n starts at column line n.
col_start_auto auto-places column start.
col_end n ends at column line n.
col_end_auto auto-places column end.
Grid Template Rows
grid_rows n creates a grid with n equal rows.
grid_rows_none removes grid template rows.
grid_rows_subgrid uses subgrid for rows.
Grid Row
row_auto sets grid-row to auto.
row_span n makes element span n rows.
row_span_full spans all rows.
row_start n starts at row line n.
row_start_auto auto-places row start.
row_end n ends at row line n.
row_end_auto auto-places row end.
Grid Auto Flow
grid_flow_row sets auto-placement to fill rows.
grid_flow_col sets auto-placement to fill columns.
grid_flow_dense uses dense packing algorithm.
grid_flow_row_dense fills rows with dense packing.
grid_flow_col_dense fills columns with dense packing.
Grid Auto Columns
auto_cols_auto sets implicit columns to auto.
auto_cols_min sets implicit columns to min-content.
auto_cols_max sets implicit columns to max-content.
auto_cols_fr sets implicit columns to 1fr.
Grid Auto Rows
auto_rows_auto sets implicit rows to auto.
auto_rows_min sets implicit rows to min-content.
auto_rows_max sets implicit rows to max-content.
auto_rows_fr sets implicit rows to 1fr.
Gap
gap n sets spacing between items in flex/grid containers using Tailwind scale. More modern and flexible than using margins on children.
Example:
let button_row = to_classes [ flex; gap 4 ]
gap' n is gap for a half-step scale value (e.g. gap' 0.5 for gap-0.5).
gap_x n sets only horizontal gaps in flex/grid containers.
gap_x' n is gap_x for a half-step scale value.
gap_y n sets only vertical gaps in flex/grid containers.
gap_y' n is gap_y for a half-step scale value.
gap_px sets 1px gap between items.
gap_full sets 100% gap between items.
Justify Content
justify_start aligns content to the start of the container.
justify_end aligns content to the end of the container.
justify_center centers content in the container.
justify_between distributes items evenly with first item at start and last at end.
justify_around distributes items evenly with equal space around each item.
justify_evenly distributes items evenly with equal space between them.
Justify Items
justify_items_start justifies items to start.
justify_items_end justifies items to end.
justify_items_center centers items.
Sourceval justify_items_stretch : t justify_items_stretch stretches items.
Justify Self
justify_self_auto uses the default justification.
justify_self_start justifies item to the start.
justify_self_end justifies item to the end.
justify_self_center centers the item.
justify_self_stretch stretches the item.
Align Content
Sourceval content_start : t content_start aligns lines/rows to the start of the container's cross axis. For flex containers with multiple lines or grid containers with multiple rows.
Sourceval content_end : t content_end aligns lines/rows to the end of the container's cross axis.
Sourceval content_center : t content_center centers lines/rows along the container's cross axis.
Sourceval content_between : t content_between distributes lines/rows evenly: first at start, last at end.
Sourceval content_around : t content_around distributes lines/rows evenly with equal space around each.
Sourceval content_evenly : t content_evenly distributes lines/rows evenly with equal space between and around all.
Sourceval content_stretch : t content_stretch stretches lines/rows to fill the container's cross axis.
Align Items
items_start aligns items to the start of the cross axis.
items_end aligns items to the end of the cross axis.
items_center centers items along the cross axis.
items_baseline aligns items along their text baseline.
items_stretch stretches items to fill the cross axis (default).
Align Self
self_auto uses parent's align-items value (default).
self_start aligns the item to the start of the container's cross axis.
self_end aligns the item to the end of the container's cross axis.
self_center centers the item along the container's cross axis.
self_baseline aligns the item along the text baseline.
self_stretch stretches the item to fill the container's cross axis.
Place Content
Sourceval place_content_start : t place_content_start aligns content to start in both axes. Shorthand for align-content and justify-content.
Sourceval place_content_end : t place_content_end aligns content to end in both axes.
Sourceval place_content_center : t place_content_center centers content in both axes. Perfect for centering grid content.
Sourceval place_content_between : t place_content_between distributes content with space between in both axes.
Sourceval place_content_around : t place_content_around distributes content with space around in both axes.
Sourceval place_content_evenly : t place_content_evenly distributes content evenly in both axes.
Sourceval place_content_stretch : t place_content_stretch stretches content to fill both axes.
Place Items
place_items_start aligns items to start in both axes. Shorthand for align-items and justify-items.
place_items_end aligns items to end in both axes.
place_items_center centers items in both axes. Common for centering grid items.
place_items_stretch stretches items to fill both axes (default).
Place Self
place_self_auto uses parent's place-items value. Shorthand for align-self and justify-self.
place_self_start aligns to start in both axes.
place_self_end aligns to end in both axes.
place_self_center centers in both axes.
place_self_stretch stretches to fill both axes.
Spacing
Padding
p n sets padding (inner spacing) on all sides using Tailwind scale (n × 0.25rem).
Examples:
p 4: 1rem padding on all sidesp 0: Remove all paddingp 8: 2rem padding on all sides.
p' n is p for a half-step scale value (e.g. p' 0.5 for p-0.5).
px n sets horizontal padding (left and right). Common for buttons and cards to have more horizontal than vertical padding.
px' n is px for a half-step scale value.
py n sets vertical padding (top and bottom). Often smaller than horizontal padding for better proportions.
py' n is py for a half-step scale value.
pt' n is pt for a half-step scale value.
pr' n is pr for a half-step scale value.
pb n sets bottom padding.
pb' n is pb for a half-step scale value.
pl' n is pl for a half-step scale value.
p_px sets 1px padding on all sides.
p_full sets 100% padding on all sides.
px_px sets 1px horizontal padding.
px_full sets 100% horizontal padding.
py_px sets 1px vertical padding.
py_full sets 100% vertical padding.
pt_px sets 1px top padding.
pt_full sets 100% top padding.
pr_px sets 1px right padding.
pr_full sets 100% right padding.
pb_px sets 1px bottom padding.
pb_full sets 100% bottom padding.
pl_px sets 1px left padding.
pl_full sets 100% left padding.
Margin
m n sets margin (outer spacing) on all sides using Tailwind scale (n × 0.25rem).
Examples:
m 4: 1rem margin on all sidesm 0: Remove all margins.
m' n is m for a half-step scale value (e.g. m' 0.5 for m-0.5).
mx n sets horizontal margin (left and right).
mx' n is mx for a half-step scale value.
my n sets vertical margin (top and bottom). Useful for spacing between sections.
my' n is my for a half-step scale value.
mt' n is mt for a half-step scale value.
mr' n is mr for a half-step scale value.
mb' n is mb for a half-step scale value.
ml' n is ml for a half-step scale value.
m_auto sets auto margins on all sides (centers if width is defined).
mx_auto centers block elements horizontally. Very commonly used.
my_auto sets auto vertical margins.
mt_auto pushes element to bottom by setting auto top margin.
mr_auto pushes element to left by setting auto right margin.
mb_auto pushes element to top by setting auto bottom margin.
ml_auto pushes element to right by setting auto left margin.
space_x n sets horizontal space between child elements. n is the spacing multiplier (e.g., 2 for space-x-2).
space_x' n is space_x for a half-step scale value (e.g. space_x' 2.5 for space-x-2.5).
space_y n sets vertical space between child elements. n is the spacing multiplier (e.g., 2 for space-y-2).
space_y' n is space_y for a half-step scale value.
Sizing
Width
w n sets element width using Tailwind scale (n × 0.25rem).
w' n is w for a half-step scale value (e.g. w' 0.5 for w-0.5).
w_full sets width to 100% of parent.
w_fit uses fit-content sizing.
w_screen sets width to full viewport width (100vw).
w_min sets width to min-content.
w_max sets width to max-content.
Min Width
min_w n sets minimum width using Tailwind scale.
min_w' n is min_w for a half-step scale value.
min_w_full sets minimum width to 100% of parent.
Max Width
max_w n sets maximum width using Tailwind scale.
max_w' n is max_w for a half-step scale value.
max_w_xs sets maximum width to 20rem.
max_w_sm sets maximum width to 24rem.
max_w_md sets maximum width to 28rem.
max_w_lg sets maximum width to 32rem.
max_w_xl sets maximum width to 36rem.
max_w_2xl sets maximum width to 42rem.
max_w_3xl sets maximum width to 48rem.
max_w_4xl sets maximum width to 56rem.
max_w_5xl sets maximum width to 64rem.
max_w_6xl sets maximum width to 72rem.
max_w_7xl sets maximum width to 80rem.
max_w_none removes the maximum width constraint.
max_w_full sets maximum width to 100% of parent.
max_w_min sets maximum width to min-content.
max_w_max sets maximum width to max-content.
max_w_fit sets maximum width to fit-content.
max_w_prose sets maximum width to 65ch (ideal for reading).
max_w_screen_sm sets maximum width to 640px.
max_w_screen_md sets maximum width to 768px.
max_w_screen_lg sets maximum width to 1024px.
max_w_screen_xl sets maximum width to 1280px.
max_w_screen_2xl sets maximum width to 1536px.
Height
h n sets element height using Tailwind scale (n × 0.25rem).
h' n is h for a half-step scale value.
h_full sets height to 100% of parent.
h_fit uses fit-content sizing for height.
h_screen sets height to full viewport height (100vh).
h_min sets height to min-content.
h_max sets height to max-content.
Min Height
min_h n sets minimum height using Tailwind scale.
min_h' n is min_h for a half-step scale value.
min_h_screen sets viewport minimum height.
min_h_full sets minimum height to 100% of parent.
Max Height
max_h n sets maximum height using Tailwind scale.
max_h' n is max_h for a half-step scale value (e.g. max_h' 1.5 for max-h-1.5).
max_h_full sets maximum height to 100% of parent.
Size
size n sets both width and height using Tailwind scale (n × 0.25rem).
size' n is size for a half-step scale value (e.g. size' 0.5 for size-0.5).
size_auto sets both width and height to auto.
size_full sets both width and height to 100% of parent.
size_min sets both width and height to min-content.
size_max sets both width and height to max-content.
size_fit sets both width and height to fit-content.
Typography
Font Family
font_sans selects a sans-serif font family.
font_serif selects a serif font family.
font_mono selects a monospace font family.
Font Size
text_xs sets extra small text (12px) for captions, labels, and fine print.
text_sm sets small text (14px) for secondary content and form labels.
text_base sets base text (16px): default body text size with good readability.
text_lg sets large text (18px) for emphasized paragraphs and lead text.
text_xl sets extra large text (20px) for section introductions.
text_2xl sets 2× large text size (1.5rem).
text_3xl sets 3× large text size (1.875rem).
text_4xl sets 4× large text size (2.25rem).
text_5xl sets 5× large text size (3rem).
Font Smoothing
antialiased enables font antialiasing for smoother text rendering.
Font Style
italic applies italic text style.
not_italic removes italic text style.
Font Weight
font_thin uses the thinnest font weight (100). Use sparingly; it may not be visible with all fonts.
font_light uses light font weight (300) for subtle, delicate text.
font_normal uses normal font weight (400), the default for body text.
font_medium uses medium font weight (500), slightly bolder than normal; good for UI labels.
font_semibold uses semi-bold font weight (600) for subheadings and emphasis.
font_bold uses bold font weight (700) for headings and strong emphasis.
font_extrabold uses extra bold font weight (800) for major headings.
font_black uses the heaviest font weight (900) for maximum impact and hero text.
Font Stretch
font_stretch_normal uses the normal font stretch.
Sourceval font_stretch_condensed : t font_stretch_condensed uses a condensed font stretch.
Sourceval font_stretch_expanded : t font_stretch_expanded uses an expanded font stretch.
Sourceval font_stretch_percent : int -> t font_stretch_percent n sets font stretch to n% when available.
Numeric Variants
normal_nums resets to normal numeric glyphs.
ordinal enables ordinal markers (e.g. 1st, 2nd).
slashed_zero uses a zero with a slash.
lining_nums uses lining numbers.
oldstyle_nums uses old‑style (text) figures.
proportional_nums uses proportional width numbers.
tabular_nums uses tabular width numbers.
diagonal_fractions uses diagonal fraction glyphs.
stacked_fractions uses stacked fraction glyphs.
Letter Spacing
tracking_tighter sets letter spacing to -0.05em.
tracking_tight sets letter spacing to -0.025em.
tracking_normal sets letter spacing to 0.
tracking_wide sets letter spacing to 0.025em.
tracking_wider sets letter spacing to 0.05em.
tracking_widest sets letter spacing to 0.1em.
Line Clamp
line_clamp n truncates text to n lines with ellipsis. Use 0 to remove clamping. Useful for consistent card heights.
Example:
let summary = to_classes [ line_clamp 3 ]
Line Height
leading_none sets line height to 1; text lines touch. Only for large display text.
leading_tight sets line height to 1.25; compact spacing for headings.
leading_snug sets line height to 1.375; slightly tighter than normal.
leading_normal sets line height to 1.5 (default), optimal readability for body text.
leading_relaxed sets line height to 1.625; more open, easier scanning for long text.
leading_loose sets line height to 2; very open, good for short text blocks that need breathing room.
leading n sets arbitrary line-height from the spacing scale (n * 0.25rem).
leading' n is leading for a half-step scale value (e.g. leading' 1.5 for leading-1.5).
List Style Image
list_image_none removes list-style-image.
Sourceval list_image_url : string -> t list_image_url url sets list-style-image to url.
List Style Position
list_inside places list markers inside content box.
list_outside places list markers outside content box.
List Style Type
list_none removes bullets/numbers from lists.
list_disc uses disc bullets.
list_decimal uses decimal numbering.
Text Align
text_left left-aligns text.
Sourceval text_center : t text_center center-aligns text.
text_right right-aligns text.
Sourceval text_justify : t text_justify justifies text.
Color
Sourceval text : ?opacity:int -> ?shade:int -> color -> t text color sets text color. shade defaults to 500. opacity sets the alpha modifier (0-100).
Sourceval text_inherit : t text_inherit inherits color from the parent element.
Sourceval text_current : t text_current sets color to currentColor.
Sourceval text_transparent : t text_transparent makes text fully transparent.
Text Decoration Line
underline applies an underlined text decoration.
line_through applies a line-through text decoration.
no_underline removes text decoration.
Text Decoration Color
decoration_color ?shade color sets text-decoration color.
Text Decoration Style
decoration_solid sets text decoration style to solid (default).
decoration_double sets text decoration style to a double line.
decoration_dotted sets text decoration style to a dotted line.
decoration_dashed sets text decoration style to a dashed line.
decoration_wavy sets text decoration style to a wavy line. Good for spell check indicators.
Text Decoration Thickness
Sourceval decoration_thickness : int -> t decoration_thickness n sets text-decoration thickness to npx.
decoration_from_font uses the font's default decoration thickness.
Text Underline Offset
Sourceval underline_offset : int -> t underline_offset n sets text underline offset to npx.
Sourceval underline_offset_auto : t underline_offset_auto sets text underline offset to auto (browser default).
underline_offset_0 sets text underline offset to 0 (underline touches text).
underline_offset_1 sets text underline offset to 1px.
underline_offset_2 sets text underline offset to 2px.
underline_offset_4 sets text underline offset to 4px.
underline_offset_8 sets text underline offset to 8px.
Text Transform
uppercase transforms text to UPPERCASE. Useful for labels, badges, and emphasis.
lowercase transforms text to lowercase. Less common but useful for specific designs.
capitalize capitalizes the first letter of each word. Good for titles and headings.
normal_case removes text transformation (default). Use to override parent text-transform.
Text Overflow
Sourceval text_ellipsis : t text_ellipsis uses ellipsis when text overflows.
text_clip clips overflowing text.
Text Wrap
text_wrap enables automatic text wrapping.
Sourceval text_nowrap : t text_nowrap disables text wrapping.
Sourceval text_balance : t text_balance balances text across lines.
Sourceval text_pretty : t text_pretty optimizes wrapping for readability.
Text Indent
indent n sets text-indent to n times the spacing scale (n * 0.25rem).
indent' n is indent for a half-step scale value (e.g. indent' 0.5 for indent-0.5).
Vertical Align
align_baseline sets vertical-align to baseline.
align_top sets vertical-align to top.
align_middle sets vertical-align to middle.
align_bottom sets vertical-align to bottom.
Sourceval align_text_top : t align_text_top sets vertical-align to text-top.
Sourceval align_text_bottom : t align_text_bottom sets vertical-align to text-bottom.
align_sub sets vertical-align to sub.
align_super sets vertical-align to super.
White Space
whitespace_normal uses normal whitespace handling.
whitespace_nowrap prevents text wrapping.
whitespace_pre preserves whitespace.
whitespace_pre_line preserves line breaks.
whitespace_pre_wrap preserves whitespace and wraps.
Word Break
break_normal normal word/overflow wrapping.
break_words break words as needed.
break_all break within words to prevent overflow.
break_keep keep words intact (keep-all).
Overflow Wrap
overflow_wrap_normal uses the browser default overflow wrapping behavior.
Sourceval overflow_wrap_anywhere : t overflow_wrap_anywhere allows breaks within words to prevent overflow.
Sourceval overflow_wrap_break_word : t overflow_wrap_break_word breaks long words to prevent overflow.
Hyphens
hyphens_none disables automatic hyphenation.
hyphens_manual enables manual hyphenation via soft hyphen characters.
hyphens_auto enables automatic hyphenation when supported.
Content
Sourceval content_none : t content_none clears pseudo‑element content.
Sourceval content : string -> t content value sets pseudo‑element content to value.
Backgrounds
Background Attachment
bg_fixed fixes the background relative to the viewport.
bg_local scrolls the background with the element's contents.
bg_scroll fixes the background relative to the element.
Background Clip
bg_clip_border clips the background to the border box.
bg_clip_padding clips the background to the padding box.
Sourceval bg_clip_content : t bg_clip_content clips the background to the content box.
Sourceval bg_clip_text : t bg_clip_text clips the background to the foreground text.
Background Color
bg color sets the background color. shade defaults to 500.
Examples:
bg blue 500: Medium blue backgroundbg gray 100: Light gray backgroundbg slate 900: Very dark slate background
Shades range from 50 (lightest) to 900 (darkest).
bg_transparent makes background fully transparent.
bg_current sets background color to match the element's text color. If the element has text ~shade:500 blue, the background will also be blue-500. Useful for icons and decorative elements that should match text.
Background Image
Sourcetype direction = | Bottom| Bottom_rightGradient towards bottom-right corner
| Right| Top_rightGradient towards top-right corner
| Top| Top_leftGradient towards top-left corner
| Left| Bottom_leftGradient towards bottom-left corner
Gradient direction variants
bg_gradient_to dir sets gradient direction using a typed direction. Combine with from_color/via_color/to_color.
Example:
let gradient =
to_classes
[
bg_gradient_to Bottom;
from_color ~shade:100 blue;
to_color ~shade:600 blue;
]
from_color ~shade:400 blue sets the starting color of a gradient. Default shade is 500. Works with gradient direction utilities like bg_gradient_to_r.
Example:
let gradient =
to_classes
[
bg_gradient_to Right;
from_color ~shade:400 blue;
to_color ~shade:600 purple;
]
via_color purple sets the middle color of a gradient. Default shade is 500. Creates a three-color gradient when used with bg_gradient_to and to_color.
to_color ~shade:600 pink sets the ending color of a gradient. Default shade is 500.
Background Origin
bg_origin_border positions the background from the border box.
bg_origin_padding positions the background from the padding box.
Sourceval bg_origin_content : t bg_origin_content positions the background from the content box.
Background Position
bg_bottom positions the background at the bottom.
bg_bottom_left positions the background at the bottom left.
bg_bottom_right positions the background at the bottom right.
bg_center centers the background.
bg_left positions the background at the left.
bg_left_bottom positions the background at the left bottom.
bg_left_top positions the background at the left top.
bg_right positions the background at the right.
bg_right_bottom positions the background at the right bottom.
bg_right_top positions the background at the right top.
bg_top positions the background at the top.
bg_top_left positions the background at the top left.
bg_top_right positions the background at the top right.
Background Repeat
bg_repeat repeats the background on both axes.
bg_no_repeat prevents the background from repeating.
bg_repeat_x repeats the background horizontally.
bg_repeat_y repeats the background vertically.
bg_repeat_round repeats and scales the background to avoid clipping.
bg_repeat_space repeats the background with space between tiles.
Background Size
bg_auto uses the background image's intrinsic size.
bg_cover scales the background to cover its container.
bg_contain scales the background to fit inside its container.
Borders
Border Radius
Border Width
border sets the default border (1px). Same as border_xs.
border_none removes the border (0px).
border_xs sets extra small border (1px). Same as border.
border_sm sets small border (2px).
border_md sets medium border (4px).
border_lg sets large border (4px).
border_xl sets extra large border (8px).
border_2xl sets 2× large border (8px).
border_3xl sets 3× large border (8px).
border_full sets full border (8px).
border_t sets top border (1px).
border_r sets right border (1px).
border_b sets bottom border (1px).
border_l sets left border (1px).
Border Color
Sourceval border_color : ?opacity:int -> ?shade:int -> color -> t border_color color sets the border color. shade defaults to 500. opacity sets the alpha modifier (0-100).
border_transparent makes border fully transparent.
border_current sets border color to match the text color. For example:
let danger_border =
to_classes [ text ~shade:600 red; border_xs; border_current ]
This is the default behavior in Tailwind v4, but can be explicitly set.
border_inherit inherits the border color.
Border Style
border_solid uses a solid border style.
border_dashed uses a dashed border style.
border_dotted uses a dotted border style.
border_double uses a double border style.
Outline Width
outline_width n sets outline width to n pixels. The zero value emits outline-0.
Outline Color
Sourceval outline_color : ?opacity:int -> ?shade:int -> color -> t outline_color color sets the outline color. shade defaults to 500 and opacity sets the alpha modifier (0-100).
outline_transparent makes the outline fully transparent.
outline_current uses currentColor for the outline.
outline_inherit inherits the outline color.
Outline Style
outline_none removes the outline.
Outline Offset
outline_offset_0 sets outline offset to 0px.
outline_offset_1 sets outline offset to 1px.
outline_offset_2 sets outline offset to 2px.
outline_offset_4 sets outline offset to 4px.
outline_offset_8 sets outline offset to 8px.
rounded_none sets sharp corners (0px).
rounded_xs sets extra-small rounding (2px).
rounded_sm sets subtle rounding (2px).
rounded sets default rounding (4px). Same as rounded_md.
rounded_md sets medium rounding (6px).
rounded_lg sets noticeably rounded corners (8px).
rounded_xl sets extra rounded corners (12px).
rounded_2xl sets 2× rounded corners (16px).
rounded_3xl sets 3× rounded corners (24px).
rounded_4xl sets 4× rounded corners (32px).
rounded_full sets fully rounded corners (9999px). Makes circles/pills.
Side-specific border radius
Round specific sides (top, right, bottom, left) with consistent radius values.
rounded_t rounds the top corners with the default radius.
rounded_t_none sets no rounding on top corners.
rounded_t_xs sets extra-small rounding on top corners.
rounded_t_sm sets subtle rounding on top corners.
rounded_t_md sets medium rounding on top corners.
rounded_t_lg sets large rounding on top corners.
rounded_t_xl sets extra large rounding on top corners.
rounded_t_2xl sets 2× rounding on top corners.
rounded_t_3xl sets 3× rounding on top corners.
rounded_t_4xl sets 4× rounding on top corners.
rounded_t_full sets full rounding on top corners.
rounded_r rounds the right corners with the default radius.
rounded_r_none sets no rounding on right corners.
rounded_r_xs sets extra-small rounding on right corners.
rounded_r_sm sets subtle rounding on right corners.
rounded_r_md sets medium rounding on right corners.
rounded_r_lg sets large rounding on right corners.
rounded_r_xl sets extra large rounding on right corners.
rounded_r_2xl sets 2× rounding on right corners.
rounded_r_3xl sets 3× rounding on right corners.
rounded_r_4xl sets 4× rounding on right corners.
rounded_r_full sets full rounding on right corners.
rounded_b rounds the bottom corners with the default radius.
rounded_b_none sets no rounding on bottom corners.
rounded_b_xs sets extra-small rounding on bottom corners.
rounded_b_sm sets subtle rounding on bottom corners.
rounded_b_md sets medium rounding on bottom corners.
rounded_b_lg sets large rounding on bottom corners.
rounded_b_xl sets extra large rounding on bottom corners.
rounded_b_2xl sets 2× rounding on bottom corners.
rounded_b_3xl sets 3× rounding on bottom corners.
rounded_b_4xl sets 4× rounding on bottom corners.
rounded_b_full sets full rounding on bottom corners.
rounded_l rounds the left corners with the default radius.
rounded_l_none sets no rounding on left corners.
rounded_l_xs sets extra-small rounding on left corners.
rounded_l_sm sets subtle rounding on left corners.
rounded_l_md sets medium rounding on left corners.
rounded_l_lg sets large rounding on left corners.
rounded_l_xl sets extra large rounding on left corners.
rounded_l_2xl sets 2× rounding on left corners.
rounded_l_3xl sets 3× rounding on left corners.
rounded_l_4xl sets 4× rounding on left corners.
rounded_l_full sets full rounding on left corners.
Corner-specific border radius
Round individual corners (top-left, top-right, bottom-right, bottom-left).
rounded_tl rounds the top-left corner with the default radius.
rounded_tl_none sets no rounding on top-left corner.
rounded_tl_xs sets extra-small rounding on top-left corner.
rounded_tl_sm sets subtle rounding on top-left corner.
rounded_tl_md sets medium rounding on top-left corner.
rounded_tl_lg sets large rounding on top-left corner.
rounded_tl_xl sets extra large rounding on top-left corner.
rounded_tl_2xl sets 2× rounding on top-left corner.
rounded_tl_3xl sets 3× rounding on top-left corner.
rounded_tl_4xl sets 4× rounding on top-left corner.
rounded_tl_full sets full rounding on top-left corner.
rounded_tr rounds the top-right corner with the default radius.
rounded_tr_none sets no rounding on top-right corner.
rounded_tr_xs sets extra-small rounding on top-right corner.
rounded_tr_sm sets subtle rounding on top-right corner.
rounded_tr_md sets medium rounding on top-right corner.
rounded_tr_lg sets large rounding on top-right corner.
rounded_tr_xl sets extra large rounding on top-right corner.
rounded_tr_2xl sets 2× rounding on top-right corner.
rounded_tr_3xl sets 3× rounding on top-right corner.
rounded_tr_4xl sets 4× rounding on top-right corner.
rounded_tr_full sets full rounding on top-right corner.
rounded_br rounds the bottom-right corner with the default radius.
rounded_br_none sets no rounding on bottom-right corner.
rounded_br_xs sets extra-small rounding on bottom-right corner.
rounded_br_sm sets subtle rounding on bottom-right corner.
rounded_br_md sets medium rounding on bottom-right corner.
rounded_br_lg sets large rounding on bottom-right corner.
rounded_br_xl sets extra large rounding on bottom-right corner.
rounded_br_2xl sets 2× rounding on bottom-right corner.
rounded_br_3xl sets 3× rounding on bottom-right corner.
rounded_br_4xl sets 4× rounding on bottom-right corner.
rounded_br_full sets full rounding on bottom-right corner.
rounded_bl rounds the bottom-left corner with the default radius.
rounded_bl_none sets no rounding on bottom-left corner.
rounded_bl_xs sets extra-small rounding on bottom-left corner.
rounded_bl_sm sets subtle rounding on bottom-left corner.
rounded_bl_md sets medium rounding on bottom-left corner.
rounded_bl_lg sets large rounding on bottom-left corner.
rounded_bl_xl sets extra large rounding on bottom-left corner.
rounded_bl_2xl sets 2× rounding on bottom-left corner.
rounded_bl_3xl sets 3× rounding on bottom-left corner.
rounded_bl_4xl sets 4× rounding on bottom-left corner.
rounded_bl_full sets full rounding on bottom-left corner.
Effects
Box Shadow
shadow_none removes the shadow.
shadow_2xs applies the smallest shadow.
shadow_xs applies an extra-small shadow.
shadow_sm applies a subtle shadow for cards.
shadow applies the default shadow. Same as shadow_md.
shadow_md applies a medium shadow. Same as shadow.
shadow_lg applies a large shadow for modals and dropdowns.
shadow_xl applies an extra large shadow.
shadow_2xl applies a 2× large shadow.
shadow_inner applies an inset shadow for a pressed/sunken effect.
Opacity
opacity n controls transparency (0-100).
- 0: Fully transparent (invisible but takes space)
- 50: Half transparent
- 100: Fully opaque (default).
ring_none removes the ring.
ring_xs sets an extra small ring (1px).
ring_sm sets a small ring (2px).
ring applies the default ring (3px). Same as ring_md.
ring_md sets a medium ring (3px). Same as ring.
ring_lg sets a large ring (4px).
ring_xl sets an extra large ring (8px).
Rings use box-shadow and don't affect layout. By default, rings are blue with 50% opacity. To customize:
- Use
ring_color to change color: ring_sm; ring_color purple - Rings are often used for focus states:
on_focus [ ring ] - Unlike borders, rings don't take up space in the layout.
Ring Width
Ring Color
Sourceval ring_color : ?opacity:int -> ?shade:int -> color -> t ring_color color sets the color of outline rings. Use ~shade to pick a shade (default 500) and ~opacity to set opacity as a percentage.
Ring Offset Width
Sourceval ring_offset_width : int -> t ring_offset_width n sets the ring offset width to n pixels.
Ring Offset Color
Sourceval ring_offset_color : ?opacity:int -> ?shade:int -> color -> t ring_offset_color color sets the ring offset color. shade defaults to 500 and opacity sets the alpha modifier (0-100).
Sourceval ring_offset_transparent : t ring_offset_transparent makes the ring offset transparent.
ring_offset_current uses currentColor for the ring offset.
ring_offset_inherit inherits the ring offset color.
Text Shadow
Sourceval text_shadow_none : t text_shadow_none removes the text shadow (text-shadow: none).
Sourceval text_shadow_2xs : t text_shadow_2xs applies the 2xs text shadow.
Sourceval text_shadow_xs : t text_shadow_xs applies the xs text shadow.
Sourceval text_shadow_sm : t text_shadow_sm applies the small text shadow.
Sourceval text_shadow_md : t text_shadow_md applies the medium text shadow.
Sourceval text_shadow_lg : t text_shadow_lg applies the large text shadow.
Sourceval text_shadow_arbitrary : string -> t text_shadow_arbitrary s sets an arbitrary text-shadow value s.
Mix Blend Mode
mix_blend_normal sets mix-blend-mode: normal.
mix_blend_multiply sets mix-blend-mode: multiply.
mix_blend_screen sets mix-blend-mode: screen.
mix_blend_overlay sets mix-blend-mode: overlay.
mix_blend_darken sets mix-blend-mode: darken.
mix_blend_lighten sets mix-blend-mode: lighten.
Sourceval mix_blend_color_dodge : t mix_blend_color_dodge sets mix-blend-mode: color-dodge.
mix_blend_color_burn sets mix-blend-mode: color-burn.
mix_blend_hard_light sets mix-blend-mode: hard-light.
mix_blend_soft_light sets mix-blend-mode: soft-light.
mix_blend_difference sets mix-blend-mode: difference.
mix_blend_exclusion sets mix-blend-mode: exclusion.
mix_blend_hue sets mix-blend-mode: hue.
mix_blend_saturation sets mix-blend-mode: saturation.
mix_blend_color sets mix-blend-mode: color.
mix_blend_luminosity sets mix-blend-mode: luminosity.
Sourceval mix_blend_plus_darker : t mix_blend_plus_darker sets mix-blend-mode: plus-darker.
Sourceval mix_blend_plus_lighter : t mix_blend_plus_lighter sets mix-blend-mode: plus-lighter.
Background Blend Mode
bg_blend_normal uses normal background blending.
bg_blend_multiply uses multiply background blending.
bg_blend_screen uses screen background blending.
bg_blend_overlay uses overlay background blending.
bg_blend_darken uses darken background blending.
bg_blend_lighten uses lighten background blending.
bg_blend_color_dodge uses color-dodge background blending.
bg_blend_color_burn uses color-burn background blending.
bg_blend_hard_light uses hard-light background blending.
bg_blend_soft_light uses soft-light background blending.
bg_blend_difference uses difference background blending.
bg_blend_exclusion uses exclusion background blending.
bg_blend_hue uses hue background blending.
bg_blend_saturation uses saturation background blending.
bg_blend_color uses color background blending.
bg_blend_luminosity uses luminosity background blending.
Mask Clip
mask_clip_border sets mask-clip: border-box.
mask_clip_padding sets mask-clip: padding-box.
Sourceval mask_clip_content : t mask_clip_content sets mask-clip: content-box.
mask_clip_fill sets mask-clip: fill-box.
mask_clip_stroke sets mask-clip: stroke-box.
mask_clip_view sets mask-clip: view-box.
mask_no_clip sets mask-clip: no-clip.
Mask Composite
mask_add sets mask-composite: add.
mask_subtract sets mask-composite: subtract.
mask_intersect sets mask-composite: intersect.
mask_exclude sets mask-composite: exclude.
Mask Image
mask_none sets mask-image: none.
Mask Mode
mask_alpha sets mask-mode: alpha.
mask_luminance sets mask-mode: luminance.
mask_match sets mask-mode: match-source.
Mask Origin
mask_origin_border sets mask-origin: border-box.
mask_origin_padding sets mask-origin: padding-box.
Sourceval mask_origin_content : t mask_origin_content sets mask-origin: content-box.
mask_origin_fill sets mask-origin: fill-box.
mask_origin_stroke sets mask-origin: stroke-box.
mask_origin_view sets mask-origin: view-box.
Mask Position
mask_center sets mask-position: center.
mask_top sets mask-position: center top.
mask_top_left sets mask-position: 0 0.
mask_top_right sets mask-position: 100% 0.
mask_bottom sets mask-position: center bottom.
mask_bottom_left sets mask-position: 0 100%.
mask_bottom_right sets mask-position: 100% 100%.
mask_left sets mask-position: 0.
mask_right sets mask-position: 100%.
Mask Repeat
mask_repeat sets mask-repeat: repeat.
mask_no_repeat sets mask-repeat: no-repeat.
mask_repeat_x sets mask-repeat: repeat-x.
mask_repeat_y sets mask-repeat: repeat-y.
mask_repeat_round sets mask-repeat: round.
mask_repeat_space sets mask-repeat: space.
Mask Size
mask_auto sets mask-size: auto.
mask_cover sets mask-size: cover.
mask_contain sets mask-size: contain.
Mask Type
mask_type_alpha sets mask-type: alpha.
mask_type_luminance sets mask-type: luminance.
Filters
Filter
brightness n sets brightness filter (0-200, where 100 is normal).
contrast n sets contrast filter (0-200, where 100 is normal).
blur_none applies no blur.
blur_xs applies an extra small blur (2px).
blur_sm applies a small blur (4px).
blur applies the default blur (8px). Same as blur_md.
blur_md applies a medium blur (12px).
blur_lg applies a large blur (16px).
blur_xl applies an extra large blur (24px).
blur_2xl applies a 2× large blur (40px).
blur_3xl applies a 3× large blur (64px).
grayscale n sets the grayscale filter (0-100).
saturate n sets the saturation filter (0-200, where 100 is normal).
sepia n sets the sepia filter (0-100).
invert n sets the invert filter (0-100).
hue_rotate n rotates the hue by n degrees.
Backdrop Filter
Sourceval backdrop_brightness : int -> t backdrop_brightness n applies brightness filter to content behind element. Values: 0-200, where 100 is normal. Useful for frosted glass effects.
Example:
let frosted_overlay =
to_classes
[
backdrop_brightness 75;
backdrop_saturate 150;
bg ~shade:100 white;
opacity 30;
]
Sourceval backdrop_contrast : int -> t backdrop_contrast n sets backdrop contrast filter (0-200, where 100 is normal).
Sourceval backdrop_opacity : float -> t backdrop_opacity n sets backdrop opacity filter (0-100).
Sourceval backdrop_saturate : int -> t backdrop_saturate n sets backdrop saturation filter (0-200, where 100 is normal).
backdrop_blur_none applies no backdrop blur.
backdrop_blur_xs applies an extra small backdrop blur (2px).
backdrop_blur_sm applies a small backdrop blur (4px).
backdrop_blur applies the default backdrop blur (8px). Same as backdrop_blur_md.
backdrop_blur_md applies a medium backdrop blur (12px).
backdrop_blur_lg applies a large backdrop blur (16px).
backdrop_blur_xl applies an extra large backdrop blur (24px).
backdrop_blur_2xl applies a 2× large backdrop blur (40px).
backdrop_blur_3xl applies a 3× large backdrop blur (64px).
Tables
Border Collapse
border_collapse collapses table borders.
border_separate separates table borders.
Border Spacing
Sourceval border_spacing : int -> t border_spacing n sets border spacing using spacing scale. n is the spacing multiplier (e.g., 4 for border-spacing-4).
Sourceval border_spacing' : float -> t border_spacing' n is border_spacing for a half-step scale value (e.g. border_spacing' 0.5 for border-spacing-0.5).
Table Layout
table_auto uses automatic table layout.
table_fixed uses fixed table layout.
Caption Side
caption_top sets caption-side: top.
caption_bottom sets caption-side: bottom.
Transitions & Animations
Transition Property
transition_none enables no transition.
transition enables transitions for common properties (colors, opacity, shadow, transform).
transition_all transitions all properties.
transition_colors smoothly animates color changes (background, text, border). Essential for hover effects to feel polished.
Example:
let button =
to_classes [ bg blue; transition_colors; hover [ bg ~shade:700 blue ] ]
Duration is 150ms by default.
transition_opacity transitions opacity.
transition_shadow transitions box shadow.
transition_transform transitions transform.
Transition Behavior
Sourceval transition_behavior_normal : t transition_behavior_normal uses normal transition behavior (default).
Sourceval transition_behavior_allow_discrete : t transition_behavior_allow_discrete allows discrete transitions where supported. Useful for toggling properties like visibility in a discrete manner.
Transition Duration
duration n sets transition duration in milliseconds.
Transition Timing Function
ease_linear uses a linear transition timing function.
ease_in uses an ease-in transition timing function.
ease_out uses an ease-out transition timing function.
ease_in_out uses an ease-in-out transition timing function.
Transition Delay
delay ms sets transition/animation delay in milliseconds.
Backface Visibility
backface_visible shows the element's back face when rotated (default).
backface_hidden hides the element's back face when rotated.
Perspective
perspective_none removes perspective (perspective: none).
perspective_dramatic sets a short perspective distance for dramatic 3D effects.
perspective_normal sets a normal perspective distance.
Perspective Origin
Sourceval perspective_origin_center : t perspective_origin_center sets perspective origin to center (default).
Sourceval perspective_origin_top : t perspective_origin_top sets perspective origin to top, making 3D transforms appear from above.
Sourceval perspective_origin_bottom : t perspective_origin_bottom sets perspective origin to bottom, making 3D transforms appear from below.
Sourceval perspective_origin_left : t perspective_origin_left sets perspective origin to left side.
Sourceval perspective_origin_right : t perspective_origin_right sets perspective origin to right side.
Rotate
rotate n sets rotate transformation (degrees).
Scale
scale n resizes element by percentage (100 = normal size).
Examples:
scale 95: Slightly smaller (95%)scale 100: Normal sizescale 105: Slightly larger (105%) - nice for hover effectsscale 150: 1.5x larger
Often combined with transition_transform for smooth scaling.
Skew
skew_x n adds skewX(n deg) to the transform chain.
skew_y n adds skewY(n deg) to the transform chain.
transform enables transform utilities.
transform_none disables transforms.
transform_gpu uses GPU acceleration for transforms.
origin_center sets transform-origin: center.
origin_top sets transform-origin: top.
origin_bottom sets transform-origin: bottom.
origin_left sets transform-origin: left.
origin_right sets transform-origin: right.
origin_top_left sets transform-origin: top left.
origin_top_right sets transform-origin: top right.
origin_bottom_left sets transform-origin: bottom left.
origin_bottom_right sets transform-origin: bottom right.
Translate
translate_x n sets horizontal translation.
Sourceval translate_x' : float -> t translate_x' n is translate_x for a half-step scale value (e.g. translate_x' 0.5 for translate-x-0.5).
translate_y n sets vertical translation.
Sourceval translate_y' : float -> t translate_y' n is translate_y for a half-step scale value.
neg_translate_x_1_2 translates the element -50% horizontally (for centering).
neg_translate_y_1_2 translates the element -50% vertically (for centering).
rotate_x n rotates element around X-axis by n degrees. Positive values tilt element away from viewer at top.
rotate_y n rotates element around Y-axis by n degrees. Positive values rotate element clockwise when viewed from above.
rotate_z n rotates element around Z-axis by n degrees. Equivalent to regular rotate, positive values rotate clockwise.
translate_z n moves element along Z-axis (toward/away from viewer). Positive values move element closer, negative values move it away.
Sourceval translate_z' : float -> t translate_z' n is translate_z for a half-step scale value.
scale_z n scales element along Z-axis for 3D effects. Requires transform-style: preserve-3d on parent.
transform_style_3d preserves 3D positioning of child elements. Required for nested 3D transforms.
transform_style_flat flattens child elements into the parent's plane (default).
Container Query Utilities
Container queries allow elements to respond to their container's size rather than the viewport. Inspired by modern CSS capabilities.
container creates a responsive layout container (equivalent to .container in Tailwind v4). Sets width: 100%. Note: Responsive max-width at various breakpoints not yet implemented.
at_container enables container queries based on inline-size (equivalent to @container in Tailwind v4). Sets container-type: inline-size.
at_container_normal disables container queries (equivalent to @container-normal in Tailwind v4). Sets container-type: normal.
Sourceval at_container_named : string -> t at_container_named name creates a named container (equivalent to @container/name in Tailwind v4). Sets container-type: inline-size and container-name: name.
container_sm styles applies styles when container is ≥640px wide.
container_md styles applies styles when container is ≥768px wide.
container_lg styles applies styles when container is ≥1024px wide.
container_xl styles applies styles when container is ≥1280px wide.
container_2xl styles applies styles when container is ≥1536px wide.
Sourceval container_query : ?name:string -> int -> t list -> t container_query 500 styles applies styles when container is ≥500px. container_query ~name:"sidebar" 500 styles targets a named container.
animate_none applies no animation.
animate_spin spins the element 360° continuously. Perfect for loading spinners.
animate_ping scales and fades out like a radar ping. Great for notification badges or attention-grabbing indicators.
animate_pulse gently fades in and out. Useful for skeleton screens or loading placeholders.
animate_bounce makes the element bounce up and down. Good for scroll indicators or playful UI elements.
form_input provides base styles for input elements; resets browser defaults and provides consistent styling across browsers. Use with input elements.
form_textarea provides base styles for textarea elements; ensures consistent cross-browser appearance and behavior.
form_select provides base styles for select dropdowns; normalizes appearance across browsers while maintaining native functionality.
form_multiselect provides base styles for multi-select lists (select with multiple); matches the input styling without the dropdown chevron.
form_checkbox provides base styles for checkbox inputs; enables custom styling while maintaining accessibility.
form_radio provides base styles for radio inputs; enables custom styling while maintaining accessibility.
Accent Color
accent color sets the accent color for form controls like checkboxes and radio buttons. shade defaults to 500. opacity sets the alpha modifier (0-100).
accent_current sets accent color to currentColor.
accent_inherit sets accent color to inherit.
Caret Color
caret color sets the caret color. shade defaults to 500. opacity sets the alpha modifier (0-100).
caret_current sets caret color to currentColor.
caret_inherit sets caret color to inherit.
caret_transparent sets caret color to transparent.
Color Scheme
scheme_normal sets color-scheme: normal.
scheme_light sets color-scheme: light.
scheme_dark sets color-scheme: dark.
scheme_light_dark sets color-scheme: light dark.
scheme_only_light sets color-scheme: only light.
scheme_only_dark sets color-scheme: only dark.
Cursor
cursor_auto uses the automatic cursor.
cursor_default uses the default cursor.
cursor_pointer uses the pointer cursor.
cursor_wait uses the wait cursor.
cursor_move uses the move cursor.
cursor_not_allowed uses the not-allowed cursor.
Field Sizing
Sourceval field_sizing_content : t field_sizing_content sets field-sizing: content.
field_sizing_fixed sets field-sizing: fixed.
User Select
select_none disables text selection.
Sourceval select_text : t select_text enables text selection.
select_all selects all text on focus.
select_auto uses automatic text selection.
Pointer Events
pointer_events_none disables pointer events.
pointer_events_auto enables pointer events.
snap_none disables scroll snapping.
snap_x enables horizontal scroll snapping for carousel-like interfaces. Must be used with snap_start/center/end on children.
Example:
let carousel = to_classes [ flex; overflow_x_auto; snap_x; snap_mandatory ]
let slide = to_classes [ snap_center; flex_shrink_0; w_full ]
snap_y enables vertical scroll snapping. Similar to snap_x but for vertical scrolling.
snap_both enables both horizontal and vertical scroll snapping.
snap_mandatory enforces mandatory scroll snapping.
snap_proximity enables proximity-based scroll snapping.
snap_start snaps to the start of the container.
snap_end snaps to the end of the container.
snap_center snaps to the center of the container.
snap_align_none disables snap alignment.
snap_normal uses normal snap stop behavior.
snap_always always stops at snap positions.
scroll_auto uses auto scroll behavior.
scroll_smooth uses smooth scroll behavior.
Touch Action
touch_auto sets touch-action to auto.
touch_none disables touch gestures.
touch_manipulation enables panning and pinch zoom gestures.
touch_pan_x enables horizontal panning.
touch_pan_y enables vertical panning.
touch_pan_left enables left panning.
touch_pan_right enables right panning.
touch_pan_up enables upward panning.
touch_pan_down enables downward panning.
touch_pinch_zoom enables pinch-to-zoom gesture.
Divide
divide_x n sets the border width between horizontal children, in pixels: divide_x 2 is divide-x-2.
divide_y n sets the border width between vertical children.
divide_x_length w is divide_x with an arbitrary width, as divide-x-[3px].
divide_y_length w is divide_y with an arbitrary width.
divide_x_reverse reverses horizontal divide borders for RTL layouts.
divide_y_reverse reverses vertical divide borders.
Sourceval divide_color : ?opacity:int -> ?shade:int -> color -> t divide_color color sets the colour of the dividing borders. shade defaults to 500; opacity is the alpha modifier (0-100).
divide_transparent makes the dividing borders transparent.
divide_current takes the dividing border colour from currentColor.
divide_inherit inherits the dividing border colour.
divide_style s sets the style of the dividing borders, as divide-dashed.
scroll_m n sets scroll-margin to n spacing units (negative allowed).
scroll_m' n is scroll_m for a half-step scale value (e.g. scroll_m' 0.5 for scroll-m-0.5).
scroll_mx n sets scroll-margin-inline to n spacing units.
scroll_mx' n is scroll_mx for a half-step scale value.
scroll_my n sets scroll-margin-block to n spacing units.
scroll_my' n is scroll_my for a half-step scale value.
scroll_mt n sets scroll-margin-top to n spacing units.
scroll_mt' n is scroll_mt for a half-step scale value.
scroll_mr n sets scroll-margin-right to n spacing units.
scroll_mr' n is scroll_mr for a half-step scale value.
scroll_mb n sets scroll-margin-bottom to n spacing units.
scroll_mb' n is scroll_mb for a half-step scale value.
scroll_ml n sets scroll-margin-left to n spacing units.
scroll_ml' n is scroll_ml for a half-step scale value.
scroll_ms n sets scroll-margin-inline-start to n spacing units.
scroll_ms' n is scroll_ms for a half-step scale value.
scroll_me n sets scroll-margin-inline-end to n spacing units.
scroll_me' n is scroll_me for a half-step scale value.
scroll_mbs n sets scroll-margin-block-start to n spacing units.
scroll_mbs' n is scroll_mbs for a half-step scale value.
scroll_mbe n sets scroll-margin-block-end to n spacing units.
scroll_mbe' n is scroll_mbe for a half-step scale value.
scroll_p n sets scroll-padding to n spacing units.
scroll_p' n is scroll_p for a half-step scale value.
scroll_px n sets scroll-padding-inline to n spacing units.
scroll_px' n is scroll_px for a half-step scale value.
scroll_py n sets scroll-padding-block to n spacing units.
scroll_py' n is scroll_py for a half-step scale value.
scroll_pt n sets scroll-padding-top to n spacing units.
scroll_pt' n is scroll_pt for a half-step scale value.
scroll_pr n sets scroll-padding-right to n spacing units.
scroll_pr' n is scroll_pr for a half-step scale value.
scroll_pb n sets scroll-padding-bottom to n spacing units.
scroll_pb' n is scroll_pb for a half-step scale value.
scroll_pl n sets scroll-padding-left to n spacing units.
scroll_pl' n is scroll_pl for a half-step scale value.
scroll_ps n sets scroll-padding-inline-start to n spacing units.
scroll_ps' n is scroll_ps for a half-step scale value.
scroll_pe n sets scroll-padding-inline-end to n spacing units.
scroll_pe' n is scroll_pe for a half-step scale value.
scroll_pbs n sets scroll-padding-block-start to n spacing units.
scroll_pbs' n is scroll_pbs for a half-step scale value.
scroll_pbe n sets scroll-padding-block-end to n spacing units.
scroll_pbe' n is scroll_pbe for a half-step scale value.
Appearance
appearance_none removes default browser styling from form elements.
Resize
resize_none prevents textarea resizing.
resize_y allows vertical resizing only.
resize_x allows horizontal resizing only.
resize allows both horizontal and vertical resizing.
Will Change
will_change_auto sets will-change to auto.
will_change_scroll optimizes for scroll position changes.
Sourceval will_change_contents : t will_change_contents optimizes for content changes.
will_change_transform optimizes for transform changes.
SVG
Fill
Fill utilities are available in the Svg module.
Stroke
Stroke utilities are available in the Svg module.
Stroke Width
Stroke width utilities are available in the Svg module.
Accessibility
Forced Color Adjust
Accessibility utilities (e.g., sr-only) are available above.
sr_only Screen reader only; visually hides content while keeping it accessible.
not_sr_only reverses sr_only; it makes previously screen-reader-only content visible.
Prose Typography
The prose classes provide beautiful typographic defaults for long-form content like articles, blog posts, or documentation. They automatically style headings, paragraphs, lists, code blocks, and more.
prose applies default prose styling for article-like content. Automatically styles h1–h6, p, ul, ol, blockquote, code, and more.
Example:
let article = to_classes [ prose; prose_lg; max_w_none ]
prose_sm applies small prose styling (0.875rem base font).
prose_lg applies large prose styling (1.125rem base font).
prose_xl applies extra large prose styling (1.25rem base font).
prose_2xl applies 2× large prose styling (1.5rem base font).
prose_lead applies lead paragraph styling for prose.
prose_gray uses the gray prose color theme.
prose_slate uses the slate prose color theme.
prose_zinc uses the zinc prose color theme.
prose_neutral uses the neutral prose color theme.
prose_stone uses the stone prose color theme.
prose_invert remaps the prose palette to its inverted (dark) variant.
prose_orange uses the orange accent (link) prose color theme.
Prose markers
Convenience utilities to apply marker classes used by prose selectors.
not_prose marks a subtree to be excluded from prose styling. Alias of Prose.not_prose.
Class Generation & Internals
Sourceval to_classes : t list -> string to_classes styles converts your style list to a CSS class string. This is the main function you'll use with HTML elements.
Example:
let button_styles = [ bg blue; text white; px 4; py 2 ]
let button_class = to_classes button_styles
pp style generates a class name from a style.
of_string ?theme class_str parses a Tailwind class string into a style. theme (default Scheme.default) is consulted to validate custom tokens such as named colors and opacities defined in an @theme block.
Example:
let parsed = of_string "bg-blue-500"
let spacing = of_string "p-4"
let centered = of_string "text-center"
let invalid = of_string "unknown-class"
Returns Error (`Msg reason) if the class string is not recognized.
Sourceval split_whitespace : string -> string list split_whitespace s splits a class attribute into its class names on any HTML whitespace - space, tab, newline, carriage return or form feed - and drops empty runs. This is the split str performs, exposed so that a consumer parsing each name itself, such as Tw_html, agrees with it on what a class name is.
Example:
let names = split_whitespace "flex\n items-center"
of_classes s parses a whitespace-separated string of class names into the utilities it recognised and, in source order, the names it did not. It never raises.
A name that is no utility may be a typo or a deliberate non-tw class - a framework hook, a JS selector, a third-party widget - and parsing cannot tell the two apart, so it reports both and leaves the judgement to the caller. The Tw_html and Tw_dom renderers pass such a name through to the rendered class attribute and report it the same way.
Example:
let styles, unknown = of_classes "flex my-app-header"
str s is the utilities of of_classes s, dropping the names it did not recognise. Use of_classes to see them.
Example:
let classes = str "flex items-center gap-4 p-6 bg-white rounded-lg"
CSS Generation
This library generates Tailwind-like class names using to_classes.
Important: Class tracking and CSS file generation should be handled by the library user. For example, the Tw_html module collects all used Tw classes and generates the appropriate CSS file.
For dynamic styles that change at runtime, use to_inline_style to generate CSS properties directly for the style attribute.
to_inline_style ?theme styles generates inline CSS for the style attribute.
Note: This generates only the CSS properties for the given styles, without any Tailwind reset/prelude. The reset is only included in to_css since it's meant for complete stylesheets, not individual elements.
Perfect for tweaking individual HTML nodes with custom styles:
let inline_styles =
to_inline_style [ bg ~shade:100 blue; p 4; rounded_md; text white ]
When to use to_inline_style vs to_css:
Use to_inline_style when:
- You need dynamic styles that change at runtime
- You want to override specific styles on individual elements
- You're working with existing HTML that you can't modify classes for
- You need precise control over a single element's styling
Use to_css (preferred) when:
- You want to generate a stylesheet that can be cached and reused
- You're building a full website with consistent styling
- You want better performance (CSS classes are more efficient than inline styles)
Performance considerations: Inline styles are significantly less performant for large-scale use compared to stylesheets because:
- They increase HTML payload size (styles are repeated for each element)
- They cannot be cached by the browser like external stylesheets
- They have higher CSS specificity, making them harder to override
- They don't benefit from CSS compression and minification
Use to_inline_style sparingly for dynamic or element-specific styling only.
Color conversion utilities for Tailwind v4 compatibility
Tailwind variant helpers (hover, focus, dark, responsive, group/peer, etc.)
CSS variable tracking and generation
Sourceval theme_token_rename : theme:Scheme.t -> (string -> string) option theme_token_rename ~theme is the custom-property rename a prefix(tw) project needs when serialising its sheet, and None when the project asked for no prefix. Pass it to Css.to_string as ?rename_custom_property.
property_fallbacks rules is the \@layer properties block that gives the \@property rules among rules their initial values in a browser without \@property, under the guard the generated sheet uses for its own: a non-inheriting property on every element, an inheriting one on the root, initial where a rule names no value, and the first rule of a name winning. It is empty when rules holds no \@property.
to_css ?theme ?base ?forms ?layers styles generates a CSS stylesheet for the given styles. theme (default Scheme.default) supplies the theme values utilities read while generating CSS.
The generated CSS follows Tailwind's layering and ordering conventions:
1. Layer Order:
- base: resets, preflight styles, and semantic element defaults
- components: component classes (e.g., container or plugin-provided)
- utilities: atomic utility classes (p-4, bg-red-500, etc.)
2. Utility Ordering (within utilities layer): Utilities are sorted by category in the following order:
- Layout: position, display, float, clear, isolation, object-fit, overflow, overscroll
- Flexbox & Grid: flex properties, grid properties, gap, order, place-content/items/self
- Spacing: padding, margin, space-between
- Sizing: width, height, min/max dimensions
- Typography: font-family, font-size, font-weight, letter-spacing, line-height, text properties
- Backgrounds: background-color, background-image, gradients
- Borders: border-width, border-color, border-radius, border-style
- Effects: box-shadow, opacity, mix-blend-mode
- Filters: filter, backdrop-filter, blur, brightness, contrast
- Tables: border-collapse, border-spacing, table-layout
- Transitions & Animation: transition, duration, timing, delay, animation
- Transforms: scale, rotate, translate, skew
- Interactivity: cursor, user-select, resize, scroll-behavior
- SVG: fill, stroke
- Accessibility: sr-only, not-sr-only
Within each category, utilities maintain a stable order. Variants (hover:, sm:, etc.) are applied with responsive breakpoints in ascending order (sm → md → lg → xl → 2xl) and state modifiers in Tailwind's predetermined priority order.
Rendering choices such as variable inlining, minification, and optimization are handled by Css.to_string.
Use this to generate your main stylesheet for inclusion in HTML <head>.
Sourceval clip_polygon : (float * float) list -> t clip_polygon points clips element to a polygon defined by percentage points.
Example:
let triangular_badge =
to_classes
[ clip_polygon [ (50., 0.); (0., 100.); (100., 100.) ]; bg red ]
Modifiers
Tailwind variants like hover/focus, responsive breakpoints, dark mode, group/peer, and pseudo-elements.
State Variants
hover styles applies styles on :hover.
focus styles applies styles on :focus.
active styles applies styles on :active.
disabled styles applies styles on :disabled.
focus_within styles applies styles when any descendant has focus.
focus_visible styles applies styles when focus is visible.
Group/Peer Variants
group marks an element as a group parent.
peer marks an element as a peer for sibling selectors.
group_hover styles applies styles when .group:hover matches.
group_focus styles applies styles when .group:focus matches.
peer_hover styles applies styles when a preceding .peer:hover matches.
peer_focus styles applies styles when a preceding .peer:focus matches.
has selector styles applies styles with :has(selector).
Sourceval group_has : ?name:string -> string -> t list -> t group_has ?name selector styles applies styles under .group:has(selector).
Sourceval peer_has : ?name:string -> string -> t list -> t peer_has ?name selector styles applies styles when a preceding .peer:has(selector).
Theme/Motion/Contrast
dark styles applies styles when user prefers dark mode, or under the rules of Scheme.t.dark when the theme the CSS is generated with redeclares the variant.
motion_safe styles applies styles when reduced motion is not requested.
motion_reduce styles applies styles when reduced motion is requested.
contrast_more styles applies styles when higher contrast is preferred.
contrast_less styles applies styles when lower contrast is preferred.
starting styles applies styles using @starting-style.
Responsive Breakpoints
sm styles applies styles at small breakpoint.
md styles applies styles at medium breakpoint.
lg styles applies styles at large breakpoint.
xl styles applies styles at extra-large breakpoint.
xl2 styles applies styles at 2xl breakpoint.
Pseudo-elements
before styles applies styles to ::before. Combine with content utilities.
after styles applies styles to ::after. Combine with content utilities.
ARIA Variants
aria_checked styles applies styles when aria-checked=true.
aria_expanded styles applies styles when aria-expanded=true.
aria_selected styles applies styles when aria-selected=true.
aria_disabled styles applies styles when aria-disabled=true.
Data Attributes
data_state value style applies style when data-state=value.
Sourceval data_variant : string -> t -> t data_variant value style applies style when data-variant=value.
Sourceval data_custom : string -> string -> t -> t data_custom key value style applies style when data-key=value.
data_active styles applies styles when data-active is present.
data_inactive styles applies styles when data-inactive is present.
peer_checked styles applies styles when a preceding .peer:checked.
Prose Element Variants
These target specific HTML elements within prose content. Each variant wraps the utility in a descendant selector that targets the specified element(s), excluding elements inside .not-prose.
prose_headings styles applies styles to h1-h6, th within prose.
prose_p styles applies styles to p elements within prose.
prose_a styles applies styles to a elements within prose.
prose_strong styles applies styles to strong elements within prose.
prose_em styles applies styles to em elements within prose.
prose_code styles applies styles to code elements within prose.
prose_pre styles applies styles to pre elements within prose.
prose_ol styles applies styles to ol elements within prose.
prose_ul styles applies styles to ul elements within prose.
prose_li styles applies styles to li elements within prose.
Sourceval prose_blockquote : t list -> t prose_blockquote styles applies styles to blockquote elements within prose.
prose_h1 styles applies styles to h1 elements within prose.
prose_h2 styles applies styles to h2 elements within prose.
prose_h3 styles applies styles to h3 elements within prose.
prose_h4 styles applies styles to h4 elements within prose.
prose_h5 styles applies styles to h5 elements within prose.
prose_h6 styles applies styles to h6 elements within prose.
prose_dl styles applies styles to dl elements within prose.
prose_dt styles applies styles to dt elements within prose.
prose_dd styles applies styles to dd elements within prose.
prose_table styles applies styles to table elements within prose.
prose_tr styles applies styles to tr elements within prose.
prose_picture styles applies styles to picture elements within prose.
prose_img styles applies styles to img elements within prose.
prose_video styles applies styles to video elements within prose.
prose_figure styles applies styles to figure elements within prose.
Sourceval prose_figcaption : t list -> t prose_figcaption styles applies styles to figcaption elements within prose.
prose_hr styles applies styles to hr elements within prose.
prose_th styles applies styles to th elements within prose.
prose_td styles applies styles to td elements within prose.
prose_thead styles applies styles to thead elements within prose.
prose_kbd styles applies styles to kbd elements within prose.
Core types and helpers for Tailwind CSS DSL
Margin utilities with negative value support
Gap and space-between utilities
Flexbox display utilities (flex, inline-flex).
Flexbox property utilities (grow, shrink, basis, order, flex shortcuts).
Flexbox layout utilities (direction, wrap).
Alignment utilities for flexbox and grid layouts
Border utilities for border styles, widths, and radii
Background and gradient utilities
Sizing utilities for width and height
Layout utilities for display, positioning, and z-index
Typography utilities for text and font styling
Grid display utilities (grid, inline-grid).
Grid item placement utilities (col-n, row-n).
Grid template utilities for grid layout configuration
Divide utilities for creating gaps between child elements
Visual effects utilities for shadows, opacity, and filters
Transform utilities for 2D and 3D transformations
Interactivity utilities for selection, scroll behavior, and more
Container query utilities for responsive design based on container size
Filter utilities for visual effects like blur, brightness, and backdrop filters
Position utilities for controlling element placement
Form element utilities - matching Tailwind v4's \@tailwindcss/forms plugin.
SVG utilities for fill, stroke, and stroke-width
CSS rule output — the result of extracting a Tailwind utility class.
CSS layer assembly — converts Output.t lists into Tailwind's layered stylesheet.
Shared theme variables for consistent ordering and avoiding conflicts
Theme scheme configuration for customizing CSS output.
Utility module for common utility types and functions
Shared spacing utilities for padding, margin, and gap
Scrollbar utilities: scrollbar-width, scrollbar-gutter, scrollbar-thumb, and scrollbar-track.
zoom utilities (the zoom-* scale).
Columns utilities for multi-column layout
Contain utilities for CSS containment.
Mask utilities for CSS masking
Overscroll behavior utilities
Scroll margin and padding utilities
Arbitrary property utilities: [property:value] with optional /opacity.
Helpers for building the @layer properties block.
Parsing helpers for small integers and results.