Utilities
ARC UI components style what's inside their shadow roots and nothing outside. The spacebetween components is yours to lay out, usually with flex, gap and padding CSS written against the 237 custom properties in base.css.
The utility layer is 272 generated, arc--prefixed classes, about 2.6 KB gzipped, for spacing, layout and surface. This site loads the stylesheet, so the demos on this page use the classes themselves.
Why not Tailwind
You can use Tailwind, and for most utility work you should. Its spacing scale isn't tied to the tokens arc-card reads for its own padding.
These classes are generated from tokens.js, the same file that generatesbase.css. A class and a component that use the same step read the same custom property (.arc-p-lg and a card's default padding both read --space-lg), so overriding that token changes both:
:root { --space-md: 20px; }
/* .arc-p-md and every component's internal md spacing move together */
Every class on a token scale (spacing, color, type size, radius, shadow) takes its value from a var(). Use these where your layout should follow the tokens, and anything you like for the rest.
Install
import '@arclux/arc-ui/base.css'; /* defines the tokens */
import '@arclux/arc-ui/utilities.css'; /* uses them */
The stylesheet is separate, so if you only want the tokens you don't load it. Every class has the arc- prefix, because your project may also run Tailwind or Bootstrap, and an unprefixed .flex would collide with theirs. The prefix makes the classes longer, and a library has no way around that.
Spacing
Every step of the --space-* scale, for padding, margin and gap. The suffixes map to logical properties: x/y for the inline and block axes,s/e for start and end, t/b for block start and end. A layout built from these mirrors under dir="rtl" without a second stylesheet. Here is the same class in both directions:
.arc-ps-xl.arc-ps-xl dir="rtl".arc-p-md | padding: var(--space-md) |
.arc-px-lg | padding-inline: var(--space-lg) |
.arc-py-sm | padding-block: var(--space-sm) |
.arc-ps-xl | padding-inline-start: var(--space-xl) |
.arc-m-0 | margin: 0 |
.arc-mx-auto | margin-inline: auto |
.arc-gap-md | gap: var(--space-md) |
.arc-gap-y-lg | row-gap: var(--space-lg) |
Steps are xs sm md lg xl 2xl 3xl 4xl, plus 0 everywhere andauto on margins.
Layout
.arc-flex.arc-items-center.arc-justify-between.arc-col-span-2.arc-grid-cols-3.arc-gap-sm.arc-col-span-full- Display:
.arc-flex,.arc-inline-flex,.arc-grid,.arc-block,.arc-contents,.arc-hidden. - Flex:
.arc-flex-col,.arc-flex-wrap,.arc-flex-1,.arc-grow,.arc-shrink-0. - Alignment:
.arc-items-center,.arc-justify-between,.arc-self-end. - Grid:
.arc-grid-cols-1through-6,.arc-col-span-*,.arc-col-span-full. - Size:
.arc-w-full,.arc-h-full,.arc-max-w-full, and.arc-min-w-0, which lets a flex child shrink below its content width so its text can truncate with an ellipsis.
Surface
.arc-bg-card .arc-border .arc-rounded-md .arc-shadow-lg.arc-text-secondary .arc-text-sm.arc-text-accent-primary .arc-font-mono.arc-text-primary | color: var(--text-primary) |
.arc-text-lg | font-size: var(--text-lg) |
.arc-bg-card | background-color: var(--bg-card) |
.arc-border | border: 1px solid var(--border-default) |
.arc-border-subtle | border-color: var(--border-subtle) |
.arc-rounded-md | border-radius: var(--radius-md) |
.arc-shadow-lg | box-shadow: var(--shadow-lg) |
.arc-font-mono | font-family: var(--font-mono) |
Class names follow the token names, so .arc-text-primary is a color and.arc-text-lg is a type size, as with --text-primary and--text-lg. The generator fails the build if a new token would make a color and a size share a class name.
Font classes name the five typographic roles:.arc-font-body.arc-font-label.arc-font-mono.arc-font-display.arc-font-quote
Limits
- Light DOM only. A class can't reach into a shadow root, so these style the space around ARC UI components and nothing inside them. For that, use
::part()and the components' CSS custom properties. - No responsive or state variants. There's no
sm:orhover:. Write a media query. - No arbitrary values. A class set to an arbitrary pixel value wouldn't follow the tokens.
- Requires the tokens. The scale classes read a
var(), so loadbase.cssor define the same variables yourself.