SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

Foundations

What the general @sdxc/ui components are for, the rules every one follows, and every non-color variable they read.

The general catalogue: forms, overlays, navigation, feedback, layout and type, rendered as server HTML. Every namespace builds on it.

Colors come from the roles on Theming and shape from the variables below, so you retune a component by setting a variable.

typescript
import "@sdxc/ui/theme.css";
import { … } from "@sdxc/ui";

When to reach for it

  • Any page, app or marketing: these are the parts every other namespace composes.
  • Forms, dialogs, menus, popovers, tabs and the other controls a product needs.
  • A component you want to own: sdxc ui add copies one into your project to edit.

Shared ideas

  • Ambient headingsHeading takes its level from the nearest HeadingScope; size sets the look apart from the level.
  • Platform firstOverlays use <dialog>, the Popover API and Invoker Commands; only DialogDismiss is an island.
  • Color by rolecolor takes brand, neutral, success, warning or danger; no component hard-codes a hue.
  • TargetsSmall controls grow an invisible hit area to --ui-target-size, 44px on a coarse pointer.
  • Names checkedIcon-only controls and landmarks warn in development without an accessible name.
  • Motionspin, pulse and shimmer are CSS keyframes that soften under prefers-reduced-motion.
  • Both directionsLogical properties and :dir(rtl) mirroring keep one markup for both writing directions.

CSS variables

Every custom property the namespace reads or declares, with its default and what it controls.

Reads every role, brand, neutral, success, warning and danger; the Theming page lists them with their light and dark values. The roles are documented on Theming.

Scales

@sdxc/u's theme.css declares spacing, fonts, type and container sizes; radius and shadow are read with these defaults, and declaring one restyles every component.

VariableDefaultWhat it controls
--ui-spacing0.25remUnit of every numeric gap, padding and size step.
--ui-font-sansui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serifBody face.
--ui-font-serifui-serif, Georgia, Cambria, "Times New Roman", serifSerif face.
--ui-font-monoui-monospace, SFMono-Regular, Menlo, Consolas, monospaceCode face.
--ui-font-displayvar(--ui-font-sans)Face of Heading's display and chapter sizes.
--ui-text-xs … --ui-text-9xl0.75rem, 0.875rem, 1rem, 1.125rem, 1.25rem … 8remThe type size scale.
--ui-container-xs … --ui-container-2xl20rem, 24rem, 36rem, 48rem, 64rem, 80remThe container widths components step at.
--ui-radius-none … --ui-radius-full0px, 0.25rem, 0.375rem, 0.5rem, 0.75rem, 9999px (none, sm, md, lg, xl, full)The corner radius scale.
--ui-shadow-sm … --ui-shadow-xlfrom 0 1px 2px 0 rgb(0 0 0 / 0.05) to 0 20px 25px -5px rgb(0 0 0 / 0.1)The elevation scale.

Surfaces

Declared in theme.css, with dark values under .dark and prefers-color-scheme: dark and solid lines under prefers-contrast: more.

VariableDefaultWhat it controls
--ui-target-size1.5rem; 2.75rem on a coarse pointerSmallest pointer target a small control grows to.
--ui-shadow-ringa 1px ring at 6% black with a soft lift; 8% white in darkEdge of cards, dialogs and floating surfaces.
--ui-shadow-ring-hoverthe same ring a step strongerThe ring's hover state, for a surface that responds to the pointer.
--ui-surface-raisedwhite; a neutral 900–950 mix in darkFill of a variant="surface" button.
--ui-shadow-controla 1px drop with an inset highlight and ringTactile edge of a variant="surface" button.
--ui-shadow-surface, --ui-shadow-stagea ring with a small drop; a ring with a deep dropEdges of raised cards and staged frames, which the landing parts read.
--ui-image-outlinergb(0 0 0 / 0.1); rgb(255 255 255 / 0.1) in darkInset line that keeps an image's edge visible on a same-tone fill.

Component tuning

Each falls back to its default in the component; set it on the element, an ancestor or :root.

VariableDefaultWhat it controls
--ui-button-radiusvar(--ui-radius-md); 9999px on an icon-only buttonCorners of Button and LinkButton.
--ui-button-weight500Weight of a button's label.
--ui-button-icon-size-sm, -md, -lg2rem, 2.5rem, 3remEdge of an icon-only button at each size.
--ui-popover-offset0.5remGap between a popover or hover card and its trigger.
--ui-overlay-arrow-offset0.5remHow far an OverlayArrow reaches past its surface.
--ui-surface-padding0.25remInner padding of floating surfaces; their inner radius follows it.
--ui-hover-card-open-delay, --ui-hover-card-close-delay0.4s, 0.2sHow long a hover card waits to open and to close.
--ui-hover-card-z50Stacking order of a hover card.
--ui-slider-thumb-size, --ui-slider-thumb-border-width1.25rem, 2pxA slider thumb's size and border.
--ui-slider-track-thickness0.5remThickness of a slider's track and fill.
--ui-switch-track-inline-size, --ui-switch-track-block-size2.75rem, 1.5remWidth and height of a Switch's track.
--ui-switch-thumb-size, --ui-switch-thumb-inset1.25rem, 0.125remA Switch thumb's size and its gap to the track's edge.
--ui-checkbox-size1.25remEdge of a Checkbox.
--ui-radio-size, --ui-radio-mark-size1.25rem, 0.625remA radio's circle and its checked dot.
--ui-selection-indicator-size1remEdge of the check mark box in menus and lists.
--ui-carousel-gap, --ui-carousel-slide-size, --ui-carousel-padding1rem, 18rem, 0pxA Carousel's gap, slide size and track padding.
--ui-spinner-icon-size-sm, -md, -lg1rem, 1.25rem, 1.75remA Spinner's glyph at each size, also inside a pending Button.
--ui-image-placeholder-size-sm, -md, -lg2rem, 2.5rem, 3remAn ImagePlaceholder's edge at each size; md is also an Avatar's size.
--ui-avatar-group-ringvar(--ui-bg, Canvas)Ring between overlapping avatars in Avatar.Group.
--ui-item-gap, --ui-item-actions-gap0.75rem, 0.5remGaps between an Item's media and content, and between its actions.
--ui-item-padding-block, --ui-item-padding-inline0.625rem, 0.75remAn Item's padding.
--ui-item-media-size2remEdge of an Item's media box.
--ui-sheet-size24rem, at most 90vwWidth of a Sheet.
--ui-separator-thickness, --ui-separator-min-size1px, 1remA Separator's thickness and a vertical one's shortest length.
--ui-meter-track-block-size, --ui-progress-bar-block-size0.5rem, 0.5remHeight of a Meter's and a ProgressBar's track.
--ui-pagination-control-size2.25remEdge of each Pagination control.
--ui-tag-remove-size1remEdge of a tag's remove button.
--ui-navigation-menu-viewport-inline-size, -block-sizeautoSize of NavigationMenu's shared viewport, which transitions between panels.
--ui-typeset-size, --ui-typeset-leading, --ui-typeset-flowset by Typeset's preset; docs is 1.125rem, 1.75, 1.25emBody size, line height and space between blocks of rendered prose.
--ui-aspect-ratioset by AspectRatio from ratio; 1The box's aspect ratio.

Animations

Each animation from @sdxc/ui/animations reads its options through these, so a variable overrides the option it names.

VariableDefaultWhat it controls
--ui-spin-duration, --ui-spin-easing, --ui-spin-fade-duration1s, linear, 150msOne turn of spin(), its easing and its fade in and out.
--ui-pulse-duration, --ui-pulse-easing, --ui-pulse-fade-duration1.6s, ease-in-out, 150msOne breath of pulse(), its easing and its fade in and out.
--ui-pulse-min-opacity, --ui-pulse-max-opacity0.5, 1The dimmest and brightest points of pulse().
--ui-shimmer-duration, --ui-shimmer-easing, --ui-shimmer-band-size, --ui-shimmer-fade-duration1.6s, ease-in-out, 50%, 150msOne sweep of shimmer(), its easing, its band's width and its fade.
--ui-text-shimmer-duration, -easing, -band-size, -angle2s, linear, 30%, 90degOne sweep of textShimmer() through the glyphs, and its band.
--ui-text-shimmer-color, --ui-text-shimmer-fade-durationcurrentColor, 150msThe band's peak color and the shimmer's fade.
--ui-scroll-shadow0 4px 12px -4px rgb(0 0 0 / 0.18)Shadow scrollShadow() ramps in under a sticky header.

Set by the components

Written by a component from its props or by a mixin, and read back by its own parts. Leave them unset.

VariableDefaultWhat it controls
--ui-tab-indicator-inline-start, -inline-size, -block-start, -block-size, -opacityset by Tabs.List from activeIndex and tabSizeWhere the active tab's indicator sits and whether it shows.
--ui-slider-fillset by Slider.Track from valueHow much of the track is filled.
--ui-drawer-enter-offset, --ui-drawer-exit-offsetset by Drawer from placementWhere a drawer slides in from and out to.
--ui-sheet-enter-offset, --ui-sheet-exit-offsetset by Sheet from sideWhere a sheet slides in from and out to.
--ui-box-shadow-ringvar(--ui-shadow-ring)The ring slot of a surface's composite shadow.
--ui-view-reveal-translate, --ui-scroll-fade-directionset by viewReveal() and scrollFade()A reveal's starting offset and a scroll fade's direction, mirrored in RTL.
@sdxc/ui

Can’t find it? Contact us