Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Class utilities — supported catalog

0.3.5

superui supports a Tailwind-compatible subset of utility classes for .tsx UIs. Author with familiar class names (flex, pt-4, bg-slate-800, w-[220px]) and the supported ones are compiled into your UI’s stylesheet.

See Styling → Utility classes for how utilities work and how to enable them. This page is the catalog of what’s supported.

Limitations

  • This list is a representative subset, not a limit. Use any utility class, including arbitrary values like w-[220px] or bg-[#b83f45]; supported ones are applied. An unsupported class has no effect, and you get a build warning naming it and why it was skipped.
  • Only class names written literally in your source are applied. A class built at runtime — e.g. class={`w-[${x}px]`} — is not picked up; use a static class or an inline style for runtime-computed values.

Utility families


Display & layout

display / position / overflow — flair maps these onto bevy_ui Node.

ClassGenerated CSS
absoluteposition: absolute;
blockdisplay: block;
flexdisplay: flex;
griddisplay: grid;
hiddendisplay: none;
overflow-hiddenoverflow: hidden;
overflow-scrolloverflow: scroll;
overflow-visibleoverflow: visible;
relativeposition: relative;

Dropped candidates (flair does not render these):

  • inline-block — display — Invalid property value
  • inline-flex — display — Invalid property value
  • static — position — Invalid property value

Flexbox

flex direction, wrap, alignment, and grow/shrink.

ClassGenerated CSS
flex-1flex: 1 1 0%;
flex-autoflex: 1 1 auto;
flex-colflex-direction: column;
flex-col-reverseflex-direction: column-reverse;
flex-noneflex: none;
flex-nowrapflex-wrap: nowrap;
flex-rowflex-direction: row;
flex-row-reverseflex-direction: row-reverse;
flex-wrapflex-wrap: wrap;
flex-wrap-reverseflex-wrap: wrap-reverse;
growflex-grow: 1;
grow-0flex-grow: 0;
items-baselinealign-items: baseline;
items-centeralign-items: center;
items-endalign-items: flex-end;
items-startalign-items: flex-start;
items-stretchalign-items: stretch;
justify-aroundjustify-content: space-around;
justify-betweenjustify-content: space-between;
justify-centerjustify-content: center;
justify-endjustify-content: flex-end;
justify-evenlyjustify-content: space-evenly;
justify-startjustify-content: flex-start;
self-autoalign-self: auto;
self-centeralign-self: center;
self-endalign-self: flex-end;
self-startalign-self: flex-start;
self-stretchalign-self: stretch;
shrinkflex-shrink: 1;
shrink-0flex-shrink: 0;

Spacing — padding

padding on each side; the rem scale resolves against flair’s 16px root.

ClassGenerated CSS
p-0padding: 0px;
p-1padding: 0.25rem;
p-2padding: 0.5rem;
p-4padding: 1rem;
p-8padding: 2rem;
pb-4padding-bottom: 1rem;
pl-2padding-left: 0.5rem;
pr-2padding-right: 0.5rem;
pt-2padding-top: 0.5rem;
pt-4padding-top: 1rem;

Dropped candidates (flair does not render these):

  • px-2 — padding-inline — Property ‘padding-inline’ is not recognized as a valid property name
  • px-4 — padding-inline — Property ‘padding-inline’ is not recognized as a valid property name
  • py-2 — padding-block — Property ‘padding-block’ is not recognized as a valid property name
  • py-4 — padding-block — Property ‘padding-block’ is not recognized as a valid property name

Spacing — margin

margin on each side (including auto).

ClassGenerated CSS
m-0margin: 0px;
m-1margin: 0.25rem;
m-2margin: 0.5rem;
m-4margin: 1rem;
m-8margin: 2rem;
mb-4margin-bottom: 1rem;
ml-2margin-left: 0.5rem;
mr-2margin-right: 0.5rem;
mt-4margin-top: 1rem;

Dropped candidates (flair does not render these):

  • mx-2 — margin-inline — Property ‘margin-inline’ is not recognized as a valid property name
  • mx-4 — margin-inline — Property ‘margin-inline’ is not recognized as a valid property name
  • mx-auto — margin-inline — Property ‘margin-inline’ is not recognized as a valid property name
  • my-2 — margin-block — Property ‘margin-block’ is not recognized as a valid property name
  • my-4 — margin-block — Property ‘margin-block’ is not recognized as a valid property name

Spacing — gap

flexbox/grid gap between children.

ClassGenerated CSS
gap-0gap: 0px;
gap-1gap: 0.25rem;
gap-2gap: 0.5rem;
gap-4gap: 1rem;
gap-8gap: 2rem;
gap-x-2column-gap: 0.5rem;
gap-y-4row-gap: 1rem;

Sizing

width / height, including fractions, full, and arbitrary values.

ClassGenerated CSS
h-0height: 0px;
h-4height: 1rem;
h-8height: 2rem;
h-[100px]height: 100px;
h-fullheight: 100%;
max-h-fullmax-height: 100%;
max-w-fullmax-width: 100%;
min-h-0min-height: 0px;
min-w-0min-width: 0px;
w-0width: 0px;
w-1/2width: 50%;
w-4width: 1rem;
w-8width: 2rem;
w-[220px]width: 220px;
w-fullwidth: 100%;
w-pxwidth: 1px;

Background color

background-color from the Tailwind palette (and arbitrary hex).

ClassGenerated CSS
bg-blackbackground-color: #000;
bg-blue-500background-color: oklch(62.3% .214 259.815);
bg-green-500background-color: oklch(72.3% .219 149.579);
bg-red-500background-color: oklch(63.7% .237 25.331);
bg-slate-200background-color: oklch(92.9% .013 255.508);
bg-slate-800background-color: oklch(27.9% .041 260.031);
bg-transparentbackground-color: transparent;
bg-whitebackground-color: #fff;

Text color

color from the Tailwind palette.

ClassGenerated CSS
text-blackcolor: #000;
text-blue-500color: oklch(62.3% .214 259.815);
text-green-500color: oklch(72.3% .219 149.579);
text-red-500color: oklch(63.7% .237 25.331);
text-slate-700color: oklch(37.2% .044 257.287);
text-whitecolor: #fff;

Text

font size / weight / style / alignment.

ClassGenerated CSS
font-boldfont-weight: 700;
font-mediumfont-weight: 500;
font-normalfont-weight: 400;
font-semiboldfont-weight: 600;
italicfont-style: italic;
not-italicfont-style: normal;
text-2xlfont-size: 1.5rem; line-height: 2rem;
text-basefont-size: 1rem; line-height: 1.5rem;
text-centertext-align: center;
text-lefttext-align: left;
text-lgfont-size: 1.125rem; line-height: 1.75rem;
text-righttext-align: right;
text-smfont-size: 0.875rem; line-height: 1.25rem;
text-xlfont-size: 1.25rem; line-height: 1.75rem;
text-xsfont-size: 0.75rem; line-height: 1rem;

Dropped candidates (flair does not render these):

  • text-justify — text-align — Invalid property value

Border

border width / radius / color.

ClassGenerated CSS
borderborder-width: 1px;
border-0border-width: 0px;
border-2border-width: 2px;
border-4border-width: 4px;
border-8border-width: 8px;
border-bborder-bottom-width: 1px;
border-red-500border-color: oklch(63.7% .237 25.331);
border-slate-300border-color: oklch(86.9% .022 252.894);
border-tborder-top-width: 1px;
border-whiteborder-color: #fff;
rounded-fullborder-radius: 9999px;
rounded-lgborder-radius: 0.5rem;
rounded-mdborder-radius: 0.375rem;
rounded-noneborder-radius: 0;
rounded-smborder-radius: 0.25rem;

Catalog: 125 supported, 13 dropped candidates across 10 families.

PROJECTSUPERUI · BEVY UI
DRAWN BYSTROWK
SCALENOT TO SCALE
REVR1 · 0.1 EARLY BUILD
LICENCEMIT / APACHE-2.0