Liking cljdoc? Tell your friends :D

UniStyle › Usage › Utility reference

Utility reference

Every utility in uni.style.core, grouped like the Tailwind docs. Each row shows one utility, its variations, and example CSS for one call. Variations take the same arguments as the utility, except presets such as w-full or m-auto, which take none.

Arguments must be known at compile time; see Basics. The notes use these argument types:

TypeAccepts
LengthA non-negative number in pixels, a CSS string such as "50%", or a CSS variable keyword such as :gap
Signed lengthA length that can also be negative
ColorA CSS string, a CSS variable keyword, or (s/alpha color percent). A variable keyword can take a fallback color as a second argument: (s/bg :card-bg "#fff")

Spacing

UtilityVariationsExample CSSNotes
ppx, py, pt, pr, pb, pl, ps, pepadding: 4pxLength. px/py are the inline and block axes; ps/pe are inline start and end.
mmx, my, mt, mr, mb, ml, ms, me, m-auto, mx-auto, my-auto, mt-auto, mr-auto, mb-auto, ml-automargin: -4pxSigned length. The -auto versions take no argument.
gapgap-x, gap-ygap: 8pxLength.
space-yspace-xmargin-bottom: 8pxLength. A bottom (or end) margin on every child except the last, without specificity. Prefer gap in flex and grid layouts.
scroll-pscroll-px, scroll-py, scroll-pt, scroll-pr, scroll-pb, scroll-plscroll-padding: 8pxLength.
scroll-mscroll-mx, scroll-my, scroll-mt, scroll-mr, scroll-mb, scroll-mlscroll-margin: 8pxSigned length.

Sizing

UtilityVariationsExample CSSNotes
ww-auto, w-full, w-min, w-max, w-fitwidth: 200pxLength. The presets set auto, 100%, min-content, max-content, and fit-content.
hh-auto, h-full, h-min, h-max, h-fitheight: 100vhLength.
sizesize-auto, size-full, size-min, size-max, size-fitheight: 16px;
width: 16px;
Length. Sets width and height.
min-wmin-w-auto, min-w-full, min-w-min, min-w-max, min-w-fitmin-width: 0Length.
min-hmin-h-auto, min-h-full, min-h-min, min-h-max, min-h-fitmin-height: 40pxLength.
max-wmax-w-auto, max-w-full, max-w-min, max-w-max, max-w-fit, max-w-nonemax-width: 640pxLength.
max-hmax-h-auto, max-h-full, max-h-min, max-h-max, max-h-fit, max-h-nonemax-height: 50vhLength.
aspect-ratio aspect-ratio: 16 / 9A CSS string or a CSS variable keyword.

Layout

UtilityVariationsExample CSSNotes
flexblock, inline, inline-block, flow-root, inline-flex, grid, inline-grid, list-item, contents, hiddendisplay: flexdisplay.
relativestatic, fixed, absolute, stickyposition: relativeposition.
insetinset-x, inset-y, top, right, bottom, left, inset-auto, inset-x-auto, inset-y-auto, top-auto, right-auto, bottom-auto, left-autoinset: 0pxSigned length. The -auto versions take no argument.
zz-autoz-index: 10An integer or a CSS variable keyword.
overflow-hiddenoverflow-auto, overflow-clip, overflow-visible, overflow-scroll, overflow-x-auto, overflow-x-hidden, overflow-x-clip, overflow-x-visible, overflow-x-scroll, overflow-y-auto, overflow-y-hidden, overflow-y-clip, overflow-y-visible, overflow-y-scrolloverflow: hidden
overscroll-containoverscroll-auto, overscroll-none, overscroll-x-auto, overscroll-x-contain, overscroll-x-none, overscroll-y-auto, overscroll-y-contain, overscroll-y-noneoverscroll-behavior: contain
visibleinvisible, collapsevisibility: hiddenvisibility.
box-borderbox-contentbox-sizing: border-box
float-leftfloat-right, float-start, float-end, float-nonefloat: left
isolateisolation-autoisolation: isolate
object-coverobject-contain, object-fill, object-none, object-scale-downobject-fit: cover
columns columns: 3A number of columns, or a column width as a CSS string.
break-inside-avoidbreak-inside-auto, break-inside-avoid-page, break-inside-avoid-columnbreak-inside: avoid
container-inline-sizecontainer-normal, container-size, container-scroll-state, container-anchoredcontainer-type: inline-sizecontainer-type. The s/container modifier queries it.
scheme-darkscheme-normal, scheme-light, scheme-light-dark, scheme-only-dark, scheme-only-lightcolor-scheme: darkcolor-scheme.
align-middlealign-baseline, align-top, align-bottom, align-text-top, align-text-bottom, align-sub, align-supervertical-align: middlevertical-align.
border-collapseborder-separate, table-auto, table-fixedborder-collapse: collapse
border-spacing border-spacing: 4pxLength.
clip-path clip-path: inset(0 round 4px)A CSS string or a CSS variable keyword.
contentcontent-nonecontent: '→'A string, quoted for you, or a CSS variable keyword. (s/content "") gives content: ''.
sr-onlynot-sr-onlyborder-width: 0;
margin: -1px;
overflow: hidden;
padding: 0;
clip-path: inset(50%);
height: 1px;
position: absolute;
white-space: nowrap;
width: 1px;
Hides an element visually but keeps it for screen readers.

Flexbox and grid

UtilityVariationsExample CSSNotes
flex-rowflex-row-reverse, flex-col, flex-col-reverseflex-direction: column
flex-wrapflex-wrap-reverse, flex-nowrapflex-wrap: wrap
flex-1flex-auto, flex-initial, flex-noneflex: 1 1 0%
growshrinkflex-grow: 1A non-negative number, 1 by default.
basisbasis-auto, basis-fullflex-basis: 120pxLength.
orderorder-first, order-last, order-noneorder: 2An integer.
items-centeritems-start, items-end, items-end-safe, items-center-safe, items-baseline, items-baseline-last, items-stretch, items-inherit, itemsalign-items: centeralign-items. items takes a value.
self-centerself-auto, self-start, self-end, self-end-safe, self-center-safe, self-stretch, self-baseline, self-baseline-lastalign-self: centeralign-self.
justify-betweenjustify-start, justify-end, justify-end-safe, justify-center, justify-center-safe, justify-around, justify-evenly, justify-stretch, justify-baseline, justify-normaljustify-content: space-betweenjustify-content.
justify-items-centerjustify-items-start, justify-items-end, justify-items-end-safe, justify-items-center-safe, justify-items-stretch, justify-items-normaljustify-items: center
justify-self-centerjustify-self-auto, justify-self-start, justify-self-center-safe, justify-self-end, justify-self-end-safe, justify-self-stretchjustify-self: center
content-centercontent-normal, content-start, content-end, content-between, content-around, content-evenly, content-baseline, content-stretchalign-content: centeralign-content.
grid-colsgrid-rows, grid-auto-cols, grid-auto-rowsgrid-template-columns: repeat(3, minmax(0, 1fr))A CSS string, number, or CSS variable keyword.
grid-flow-colgrid-flow-row, grid-flow-dense, grid-flow-row-dense, grid-flow-col-densegrid-auto-flow: column
col-spanrow-spangrid-column: span 2 / span 2A positive integer.
grid-colgrid-col-start, grid-col-end, grid-row, grid-row-start, grid-row-end, grid-areagrid-column: 1 / -1A CSS string, number, or CSS variable keyword.

Typography

UtilityVariationsExample CSSNotes
font-sizefont-size-inheritfont-size: 14pxLength.
text font-size: 14px;
line-height: 20px;
Font size and line height. A number line height is unitless, so use a string for pixels.
line-heightline-height-none, line-height-inheritline-height: 1.5A number (unitless), a CSS string, or a CSS variable keyword.
fontfont-mono, font-inheritfont-family: Inter, sans-seriffont-family: a CSS string or a CSS variable keyword. font-inherit sets the whole font shorthand.
font-boldfont-thin, font-extralight, font-light, font-normal, font-medium, font-semibold, font-extrabold, font-black, font-weight-inheritfont-weight: 700
italicnot-italicfont-style: italic
tracking letter-spacing: 0.02emSigned length: like a length, but negative numbers are allowed.
text-centertext-left, text-right, text-justify, text-start, text-endtext-align: center
uppercaselowercase, capitalize, normal-casetext-transform: uppercase
truncatetext-ellipsis, text-clipoverflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
truncate clips one line with an ellipsis.
whitespace-nowrapwhitespace-normal, whitespace-pre, whitespace-pre-line, whitespace-pre-wrap, whitespace-break-spaceswhite-space: nowrap
text-balancetext-wrap, text-nowrap, text-prettytext-wrap: balancetext-wrap.
word-break-allword-break-normal, word-break-word, word-break-keepword-break: break-all
overflow-wrap-anywhereoverflow-wrap-normal, overflow-wrap-break-wordoverflow-wrap: anywhere
line-clampline-clamp-noneoverflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
display: -webkit-box;
A positive integer.
underlineoverline, line-through, no-underlinetext-decoration-line: underline
decorationdecoration-inherit, decoration-current, decoration-transparenttext-decoration-color: #f00Color: a CSS string, a CSS variable keyword, or s/alpha. A variable keyword can take a fallback color as a second argument.
decoration-wavydecoration-solid, decoration-double, decoration-dotted, decoration-dashedtext-decoration-style: wavy
decoration-thickness text-decoration-thickness: 2pxLength.
underline-offset text-underline-offset: 4pxLength.
indent text-indent: 16pxSigned length: like a length, but negative numbers are allowed.
text-shadowtext-shadow-nonetext-shadow: 0 1px 2px #0003A CSS string, a CSS variable keyword, or several strings, keywords, and numbers concatenated without separators.
antialiasedsubpixel-antialiased-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
list-disclist-decimal, list-none, list-inside, list-outside, list-image-nonelist-style-type: disc

Colors and backgrounds

UtilityVariationsExample CSSNotes
colorcolor-transparent, color-current, color-inheritcolor: #111Color: a CSS string, a CSS variable keyword, or s/alpha. A variable keyword can take a fallback color as a second argument.
bgbg-transparent, bg-current, bg-inherit, bg-unsetbackground-color: var(--card-bg, #fff)Color: a CSS string, a CSS variable keyword, or s/alpha. A variable keyword can take a fallback color as a second argument.
bg-overlay background-image: linear-gradient(color-mix(in oklab, #000 5%, transparent), color-mix(in oklab, #000 5%, transparent))Color. Paints over the element's own background, so a translucent tint never shows what's behind the element.
bg-imagebg-nonebackground-image: url(/bg.png)A CSS string, a CSS variable keyword, or several strings, keywords, and numbers concatenated without separators.
bg-sizebg-auto, bg-cover, bg-containbackground-size: coverA CSS string or a CSS variable keyword.
bg-positionbg-top-left, bg-top, bg-top-right, bg-left, bg-center, bg-right, bg-bottom-left, bg-bottom, bg-bottom-rightbackground-position: centerA CSS string or a CSS variable keyword.
bg-no-repeatbg-repeat, bg-repeat-x, bg-repeat-y, bg-repeat-space, bg-repeat-roundbackground-repeat: no-repeat
bg-clip-textbg-clip-border, bg-clip-padding, bg-clip-contentbackground-clip: text
bg-blend-multiplybg-blend-normal, bg-blend-screen, bg-blend-overlay, bg-blend-darken, bg-blend-lighten, bg-blend-color-dodge, bg-blend-color-burn, bg-blend-hard-light, bg-blend-soft-light, bg-blend-difference, bg-blend-exclusion, bg-blend-hue, bg-blend-saturation, bg-blend-color, bg-blend-luminositybackground-blend-mode: multiply
mix-blend-multiplymix-blend-normal, mix-blend-screen, mix-blend-overlay, mix-blend-darken, mix-blend-lighten, mix-blend-color-dodge, mix-blend-color-burn, mix-blend-hard-light, mix-blend-soft-light, mix-blend-difference, mix-blend-exclusion, mix-blend-hue, mix-blend-saturation, mix-blend-color, mix-blend-luminosity, mix-blend-plus-darker, mix-blend-plus-lightermix-blend-mode: multiply
fillstrokefill: currentColorColor: a CSS string, a CSS variable keyword, or s/alpha. A variable keyword can take a fallback color as a second argument.
caretcaret-inherit, caret-current, caret-transparentcaret-color: #00fA CSS string or a CSS variable keyword.
opacity opacity: 50%An integer percentage from 0 to 100, a CSS string, or a CSS variable keyword.
mask-imagemask-size, mask-position-webkit-mask-image: url(/mask.svg);
mask-image: url(/mask.svg);
Like bg-image, bg-size, and bg-position, with -webkit- prefixes.
mask-type-alphamask-type-luminancemask-type: alpha

Borders and outlines

UtilityVariationsExample CSSNotes
borderborder-t, border-r, border-b, border-l, border-x, border-yborder-color: #ddd;
border-style: solid;
border-width: 1px;
[width] color [fallback]. Width defaults to 1px. Sets a solid style; see border forms.
border-dashedborder-dotted, border-double, border-t-dashed, border-r-dashed, border-b-dashed, border-l-dashed, border-t-dotted, border-r-dotted, border-b-dotted, border-l-dotted, border-t-double, border-r-double, border-b-double, border-l-doubleborder-color: #ddd;
border-style: dashed;
border-width: 2px;
Like border with another style. Without arguments, sets only the style.
border-solidborder-noneborder-style: noneSets only the style.
border-width border-width: 2pxLength.
border-color border-color: #dddColor: a CSS string, a CSS variable keyword, or s/alpha. A variable keyword can take a fallback color as a second argument.
divide-ydivide-xborder-bottom-color: #ddd;
border-bottom-style: solid;
border-bottom-width: 1px;
Like border. A bottom (or right) border on every child except the last, without specificity.
roundedrounded-t, rounded-r, rounded-b, rounded-l, rounded-tl, rounded-tr, rounded-br, rounded-blborder-radius: 8pxLength.
outline outline-color: #00f;
outline-style: solid;
outline-width: 2px;
[width] color [fallback], like border.
outline-dashedoutline-solid, outline-dotted, outline-double, outline-none, outline-hiddenoutline-style: dashedSets only the style.
outline-width outline-width: 2pxLength.
outline-color outline-color: #00fColor: a CSS string, a CSS variable keyword, or s/alpha. A variable keyword can take a fallback color as a second argument.
outline-offset outline-offset: 2pxSigned length. A CSS variable keyword can take a fallback as a second argument.

Effects

UtilityVariationsExample CSSNotes
shadowshadow-none--us-shadow: 0 1px 2px #0002;
box-shadow: var(--us-inset-shadow, 0 0 #0000), var(--us-inset-ring-shadow, 0 0 #0000), var(--us-ring-shadow, 0 0 #0000), var(--us-shadow, 0 0 #0000);
A CSS string, a CSS variable keyword, or several strings, keywords, and numbers concatenated without separators. Combines with rings; see shadows and rings.
inset-shadowinset-shadow-none--us-inset-shadow: inset 0 1px #0002;
box-shadow: var(--us-inset-shadow, 0 0 #0000), var(--us-inset-ring-shadow, 0 0 #0000), var(--us-ring-shadow, 0 0 #0000), var(--us-shadow, 0 0 #0000);
Like shadow; adds inset to each shadow.
ringring-none, inset-ring, inset-ring-none--us-ring-shadow: 0 0 0 2px #00f;
box-shadow: var(--us-inset-shadow, 0 0 #0000), var(--us-inset-ring-shadow, 0 0 #0000), var(--us-ring-shadow, 0 0 #0000), var(--us-shadow, 0 0 #0000);
[width] color [fallback], like border.
filter filter: grayscale(1)A CSS string or a CSS variable keyword.
blur filter: blur(4px)Length. Sets the whole filter.
backdrop-blurbackdrop-blur-none-webkit-backdrop-filter: blur(4px);
backdrop-filter: blur(4px);
A CSS string or a CSS variable keyword.

Transforms

UtilityVariationsExample CSSNotes
translatetranslate-x, translate-y, translate-none--us-translate-x: 8px;
--us-translate-y: -4px;
translate: var(--us-translate-x, 0) var(--us-translate-y, 0);
Signed length per axis. Combines with scale and rotate.
scalescale-x, scale-y, scale-none--us-scale-x: 0.8;
--us-scale-y: 0.8;
scale: var(--us-scale-x, 1) var(--us-scale-y, 1);
A percentage. scale-x and scale-y accept negatives to flip.
rotaterotate-nonerotate: 45degDegrees, a CSS string, or a CSS variable keyword.
transformtransform-nonetransform: rotate(90deg) translateX(1px)A CSS string or a CSS variable keyword.
originorigin-center, origin-top, origin-top-right, origin-right, origin-bottom-right, origin-bottom, origin-bottom-left, origin-left, origin-top-lefttransform-origin: top leftA CSS string or a CSS variable keyword.
transform-bordertransform-content, transform-fill, transform-stroke, transform-viewtransform-box: border-boxtransform-box.
backface-hiddenbackface-visiblebackface-visibility: hidden

Transitions

UtilityVariationsExample CSSNotes
transition transition: opacity 150ms easeA CSS string, a CSS variable keyword, or several strings, keywords, and numbers concatenated without separators.
transition-colorstransition-all, transition-opacity, transition-shadow, transition-transform, transition-nonetransition-duration: 150ms;
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
Tailwind's properties, duration, and easing.
durationduration-initialtransition-duration: 200msMilliseconds, a CSS string, or a CSS variable keyword.
easeease-linear, ease-in, ease-out, ease-in-out, ease-initialtransition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)A CSS string or a CSS variable keyword.
delay transition-delay: 75msMilliseconds, a CSS string, or a CSS variable keyword.
transition-discretetransition-normaltransition-behavior: allow-discretetransition-behavior.

Interactivity

UtilityVariationsExample CSSNotes
cursor-pointercursor-auto, cursor-default, cursor-wait, cursor-text, cursor-move, cursor-help, cursor-not-allowed, cursor-none, cursor-context-menu, cursor-progress, cursor-cell, cursor-crosshair, cursor-vertical-text, cursor-alias, cursor-copy, cursor-no-drop, cursor-grab, cursor-grabbing, cursor-all-scroll, cursor-col-resize, cursor-row-resize, cursor-n-resize, cursor-e-resize, cursor-s-resize, cursor-w-resize, cursor-ne-resize, cursor-nw-resize, cursor-se-resize, cursor-sw-resize, cursor-ew-resize, cursor-ns-resize, cursor-nesw-resize, cursor-nwse-resize, cursor-zoom-in, cursor-zoom-out, cursorcursor: pointercursor takes a value.
pointer-events-nonepointer-events-autopointer-events: none
select-noneselect-text, select-all, select-auto-webkit-user-select: none;
user-select: none;
Also sets -webkit-user-select.
touch-nonetouch-auto, touch-pan-x, touch-pan-left, touch-pan-right, touch-pan-y, touch-pan-up, touch-pan-down, touch-pinch-zoom, touch-manipulationtouch-action: none
resizeresize-none, resize-x, resize-yresize: none
appearance-noneappearance-autoappearance: none
will-changewill-change-auto, will-change-scroll, will-change-contents, will-change-transformwill-change: transformA CSS string or a CSS variable keyword.
snap-xsnap-none, snap-y, snap-both, snap-mandatory, snap-proximityscroll-snap-type: x var(--us-scroll-snap-strictness, proximity)scroll-snap-type.
snap-startsnap-end, snap-center, snap-align-nonescroll-snap-align: startscroll-snap-align.
scrollbar-thinscrollbar-auto, scrollbar-nonescrollbar-width: thinscrollbar-width.
scrollbar-thumbscrollbar-thumb-inherit, scrollbar-thumb-current, scrollbar-thumb-transparent, scrollbar-track, scrollbar-track-inherit, scrollbar-track-current, scrollbar-track-transparent--us-scrollbar-thumb: #888;
scrollbar-color: var(--us-scrollbar-thumb) var(--us-scrollbar-track);
Color. Thumb and track share scrollbar-color.
scrollbar-gutter-stablescrollbar-gutter-auto, scrollbar-gutter-bothscrollbar-gutter: stable

CSS variables

UtilityVariationsExample CSSNotes
var --gap: 8Sets a CSS variable (keyword or --name string) to a CSS string, number, or another variable keyword.

Border forms

border, its side and axis versions, divide-x/divide-y, outline, and ring take an optional width before the color, and an optional fallback after a CSS variable keyword:

(s/border "#ddd")                    ; width 1
(s/border 2 "#ddd")
(s/border 2 :app-border "#ddd")      ; var(--app-border, #ddd)

They set width, color, and a solid style, so a complete border is one call. border-dashed, border-dotted, and border-double take the same arguments with their style; without arguments they set only the style, so they can change an existing border. border-x and border-y set each side separately, so a later border-l still overrides the left side. Use border-width or border-color to change one part.

Shadows and rings

Shadows and rings are independent layers, as in Tailwind. Each utility sets its own CSS variable, and all of them share one composed box-shadow, so they combine on one element:

(s/c (s/shadow "0 1px 2px #0002") (s/ring 2 "#3b82f6"))
--us-shadow: 0 1px 2px #0002;
--us-ring-shadow: 0 0 0 2px #3b82f6;
box-shadow: var(--us-inset-shadow, 0 0 #0000), var(--us-inset-ring-shadow, 0 0 #0000),
            var(--us-ring-shadow, 0 0 #0000), var(--us-shadow, 0 0 #0000);

The layer variables are registered with @property as non-inheriting, so an ancestor's shadow never leaks into its descendants. The build output includes these registrations. Standalone CSS, such as s/css exports, should prepend s/property-css. Inside def-animation frames, shadows emit a direct box-shadow so keyframes interpolate.

translate and scale work the same way, with per-axis variables composed into the translate and scale properties. See Transforms.

Elsewhere


Next: Modifiers →

Usage

  1. Basics
  2. Utility reference
  3. Modifiers
  4. Transforms, transitions, and animations
  5. Themes and colors
  6. Components and variants
  7. Base styles and preflight
  8. Raw CSS
  9. Differences from Tailwind

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close