web.css
A small, flat design system for UI SDK components. Square by default, built from a handful of
tokens, with no animation and shadows only on things that float. It styles parts through their
data-slot and state attributes, so the same stylesheet works in React, Vue, Svelte,
Solid and web components.
Switch to Dark in the bar above to see every example in dark mode.
Install
Without a bundler, add two tags. The stylesheet follows the same release as the loader.
<script type="module" src="https://ui-sdk.dev/web.js"></script>
<link rel="stylesheet" href="https://ui-sdk.dev/web.css" />
With a bundler, import it once from core, next to your own CSS.
import "@ui-sdk/core/web.css"
Everything sits in @layer ui-sdk, so any style you write without a layer wins.
Components inherit your page’s font. To use the system font, set
font-family: var(--ui-font-sans) on body.
Principles
| Flat | Borders separate things. Shadows only appear on menus, lists, popovers and dialogs, which sit above the page. |
|---|---|
| Square | Corners start at zero. One token rounds everything, and small parts scale from it. |
| Still | Nothing animates. A state change is visible the moment it happens. |
| One height |
Every control is --ui-spacing × 8 tall, so inputs, selects and buttons line up
on one row.
|
| Yours to override | A low cascade layer and plain custom properties. No classes to learn and nothing to unset. |
Themes
A theme is a set of tokens. Set them on :root, or on any element to theme only what’s
inside it.
:root {
--ui-radius: 0.5rem;
--ui-spacing: 0.28125rem;
--ui-primary: light-dark(oklch(0.529 0.207 259.2), oklch(0.685 0.168 256));
}
Colors follow the page’s color-scheme. Set color-scheme: light dark to
follow the system, or dark to force it.
Foundations
Color
Eleven roles, each with a light and a dark value. Components only use roles, never raw colors, so a theme changes them all at once.
Surfaces and text
Lines
Accent and status
Focus and overlay
Typography
One base size sets the scale. Titles sit 2px above it, labels and descriptions 1px below, and small text 2px below.
| Role | Sample | Size |
|---|---|---|
| Title | Delete this project? | |
| Base | Buttons, inputs, menus and body text. | |
| Label | Email address | |
| Description | We’ll send a confirmation link. | |
| Small | Group labels and shortcuts |
Families
| --ui-font-sans | The quick brown fox jumps over the lazy dog |
| --ui-font-mono | npm install @ui-sdk/web |
Weight and leading
Three weights: 400 for text, 500 for controls and labels, 600 for titles. Running text uses
--ui-line-height.
Spacing
A single unit, --ui-spacing. Every padding, gap and height is a multiple of it, so
changing it changes the density of everything.
| Step | Used for | Value | |
|---|---|---|---|
| × 1 | Popup inset | ||
| × 1.5 | Label to control | ||
| × 2 | Item padding, icon gap | ||
| × 3 | Button padding | ||
| × 4 | Between fields, popover padding | ||
| × 6 | Dialog padding | ||
| × 8 | Control height |
Size
Controls share one height. Put any of them on a row and they line up, at every spacing and font size.
Radius
One token, --ui-radius, starting at zero. Small parts take half of it and floating
surfaces take one and a half, so nested corners stay concentric. Switches and slider thumbs go
fully round once the radius is above zero.
Elevation
Two levels. The page is flat and separated by borders. Popups add --ui-shadow, and
modals add --ui-overlay behind them.
Focus
Keyboard focus draws a 4px --ui-ring right against the control, with no gap. Fields
also turn their border to --ui-ring-border. Invalid fields use a red ring. Tab
through any example to see it.
Icons
The stylesheet draws the four icons components need, as CSS masks in currentColor, so
there’s no icon library to load. Put your own <svg> in a part and the CSS icon
steps aside.
| --ui-icon-chevron | Select, combobox, accordion, collapsible, navigation menu, submenus | |
|---|---|---|
| --ui-icon-check | Checkbox, selected items, checked menu items | |
| --ui-icon-minus | Indeterminate checkbox, number input decrement | |
| --ui-icon-plus | Number input increment |
Motion
None. Popups appear and disappear at once, switches jump, and nothing fades. Components still set
data-starting-style and data-ending-style, so you can add transitions in
your own CSS.
Components
Accordion
Stacked sections that open one at a time, divided by lines. The chevron flips when open.
accordion-itemaccordion-headeraccordion-triggeraccordion-panel
Alert dialog
Asks for a decision before anything else can happen. Use the destructive button for the risky choice.
alert-dialog-backdropalert-dialog-contentalert-dialog-titlealert-dialog-description
Autocomplete
An input that suggests values but accepts anything.
autocomplete-inputautocomplete-contentautocomplete-item
Avatar
A picture with initials to fall back on while it loads or when it fails.
avataravatar-imageavatar-fallback
Button
Outlined by default. data-variant="solid" marks the main action and
data-variant="destructive" one that deletes. A button with only an icon and an
aria-label turns square.
button[data-variant][data-disabled]
Calendar
A month in a bordered box. The selected day is filled, today is underlined, and days from other months fade.
calendarcalendar-previouscalendar-headingcalendar-nextcalendar-gridcalendar-weekdaycalendar-day[data-selected][data-range-middle][data-today]
Carousel
Previous and Next sit on either side of the slides, with a dot for each slide below. The current dot is filled.
carousel-viewportcarousel-contentcarousel-itemcarousel-previouscarousel-nextcarousel-indicator[data-selected]
Checkbox
Filled with the primary color when checked. A label around it lines the box up with the first line of text, even when the text wraps.
checkboxcheckbox-indicator[data-checked][data-indeterminate]
Collapsible
One section that shows and hides. The "Markup" toggle under every example on this page is one.
collapsible-triggercollapsible-panel
Color picker
A saturation area, hue and alpha sliders on a checkerboard, and a row of presets. The selected preset gets an outline.
color-picker-areacolor-picker-area-thumbcolor-picker-slidercolor-picker-slider-thumbcolor-picker-swatchcolor-picker-inputcolor-picker-swatch-itemcolor-picker-eye-dropper
Combobox
An input that filters a list. A trigger placed right after the input tucks into its end. A trigger on its own is a normal button.
combobox-labelcombobox-inputcombobox-triggercombobox-contentcombobox-itemcombobox-empty
Command
A searchable list of actions in a bordered panel, with groups and shortcuts.
commandcommand-inputcommand-listcommand-itemcommand-group-labelcommand-shortcut
Date input
Looks like an input. Each part of the date is its own segment, and the focused one is filled.
date-inputdate-input-segment[data-type]
Date picker
An input you can type a date into, with a calendar button inside its end. The calendar opens in a popup.
date-picker-inputdate-picker-triggerdate-picker-cleardate-picker-contentdate-picker-hint
Dialog
A focused task over a dimmed page. Title, description, content and actions.
dialog-backdropdialog-contentdialog-titledialog-descriptiondialog-close
Drawer
A panel that slides in from an edge and can be dragged closed. Its outer corners follow the radius.
drawer-backdropdrawer-viewportdrawer-contentdrawer-titledrawer-description
Field
Wraps any control with a label, a description and an error. A fieldset groups fields under a legend.
fieldfield-labelfield-descriptionfield-errorfield-setfield-legendfield-group
File input
A dashed drop zone that turns solid while you drag files over it, and a list of the files you added.
Drop files here
PNG or JPG, up to 10 MB.
file-input-dropzonefile-input-triggerfile-input-listfile-input-itemfile-input-item-remove[data-dragging]
Form
Fields validate on submit. Press "Create account" with the form empty to see errors.
Hover card
A preview of what a link points to, for people who pause on it.
hover-card-triggerhover-card-content
Image cropper
The area outside the crop is dimmed. Square handles sit on the corners and edges, and a grid shows while you drag.
image-cropper-viewportimage-cropper-imageimage-cropper-selectionimage-cropper-gridimage-cropper-handle
Input
Fills its field. Focus turns the border darker, and an invalid value turns it red.
input[data-invalid][data-disabled]
Listbox
A list you pick from in place, with checks on what’s selected.
listboxlistbox-itemlistbox-item-indicator
Meter
A measurement within a known range, like storage used.
meter-labelmeter-valuemeter-trackmeter-indicator
Number input
A number between minus and plus buttons, joined into one control. The CSS draws both icons.
number-input-groupnumber-input-controlnumber-input-decrementnumber-input-increment
OTP input
One box per character, joined into groups. The box you’re typing in gets the focus ring.
otp-input-groupotp-input-slototp-input-separator[data-active]
Pagination
Plain page numbers. The current page gets a border, and gaps show an ellipsis.
pagination-listpagination-itempagination-linkpagination-previouspagination-nextpagination-ellipsis[aria-current]
Password input
An input with a button inside its end that shows or hides what you typed.
password-inputpassword-input-controlpassword-input-toggle[data-visible]
Popover
Floating content with a title, a description and actions.
popover-triggerpopover-contentpopover-titlepopover-descriptionpopover-close
Preferences
Preferences saves a choice, like list or grid, and has no look of its own. Style what you put inside it.
display: contents
Progress
How far a task has come. Without a value it’s indeterminate and shows a still stripe.
progress-labelprogress-valueprogress-trackprogress-indicator[data-indeterminate]
Radio
Radios stay round in every theme: the circle is how people tell one choice from many.
radio-groupradioradio-indicator
Rating
Stars fill from the start in the primary color. Hovering shows what you’d pick in a lighter shade.
rating-itemrating-radio[data-filled][data-highlighted]--rating-fill
Resizable
Panels split by a 1px line. The line darkens while you hover or drag it, and has a wider hit area than it shows.
page.tsx
layout.tsx
global.css
Saved just now
Ready on port 3000
resizableresizable-panelresizable-handle[data-dragging]
Scroll area
A bordered box with a thin scrollbar that shows while you hover or scroll.
- v1.8 Faster search
- v1.7 Shared views
- v1.6 Keyboard shortcuts
- v1.5 Dark mode
- v1.4 Comments
- v1.3 Exports
- v1.2 Teams
- v1.1 Labels
- v1.0 First release
scroll-area-viewportscroll-area-contentscroll-area-scrollbarscroll-area-thumb
Segmented control
Options on a muted track. The selected one sits on a raised, bordered indicator.
segmented-control-indicatorsegmented-control-item[data-checked]
Select
Looks like an input with a chevron. Its list is at least as wide as the trigger, and the selected item shows a check.
select-triggerselect-valueselect-contentselect-itemselect-item-indicator
Separator
A 1px line in either direction. Next to text in a row it sits in the middle.
separator[data-orientation]
Slider
A thin track with a square thumb that goes round in rounded themes. It fills its container, never narrower than 12rem.
sliderslider-controlslider-trackslider-indicatorslider-thumbslider-value
Switch
For settings that apply at once. Square at zero radius, a pill above it.
switchswitch-thumb
Tabs
A line under the list, and a 2px underline on the selected tab.
tabs-listtabs-tabtabs-panel[data-selected][data-orientation]
Text elements
A few plain elements get a matching look: links, code, keys and rules.
Read the installation guide, then run
npm install @ui-sdk/web. Press Esc to close a dialog.
A paragraph after a rule.
Textarea
An input for longer text. It starts five lines tall and resizes vertically.
textarea
Time input
The same segments as Date input, for hours, minutes and AM or PM.
time-inputtime-input-segment[data-type]
Toast
A floating card in a corner of the page with a title, a description and an optional action. Toasts stack without moving.
toast-regiontoast-listtoasttoast-titletoast-descriptiontoast-actiontoast-close
Toggle
A button that stays pressed. Pressed shows a muted fill and a darker border.
toggle[data-pressed]
Toggle group
Toggles joined into one control. Only the outer corners round.
toggle-grouptoggle
Token input
A text area where mentions and tags become small bordered tokens. Type @ to try it.
token-input-editortoken-input-tokentoken-input-token-remove[data-selected]
Toolbar
Borderless buttons and toggles in a bordered strip. A pressed toggle gets a border, and separators are 1px lines.
toolbartoolbar-buttontoolbar-separatortoolbar-grouptoolbar-link
Tooltip
A short, inverted label on hover or keyboard focus. Flat, with no shadow.
tooltip-triggertooltip-content
Tree
Rows indent by level. Branches have a chevron that turns when they open, and the selected row is muted.
tree-itemtree-labeltree-indicatortree-group[data-selected][data-expanded]--tree-level
More
Patterns
Components put together the way a product would use them.
Accounts
Sign in to Acme
Welcome back. Enter your details to continue.
Notifications
Choose what we email you about.
Team
Invite your team
New members get access to every project in this workspace.
-
HG Hollis Granthollis@example.comTransfer ownership -
IM Inès Moreauines@example.comMake viewer Make admin Remove -
KM Kofi Mensahkofi@example.comMake editor Make admin Remove
Scheduling
Book a call
Pick a day and a time. We’ll send you an invite.
Checkout
Payment
You won’t be charged until your order ships.
Check your email
We sent a six digit code to hollis@example.com.
Didn’t get it? Send a new code.
Uploads
Add attachments
Files are shared with everyone on this ticket.
Drop files here
Up to 25 MB each.
Reviews
How was your stay?
Your review helps other guests choose.
Filters
128 places match.
Settings
Brand
Used for buttons and links in emails.
Workspace
export default function Page() {
return (
<main>
<h1>Welcome back</h1>
<p>Here's what changed while you were away.</p>
</main>
)
}
Data
| Invoice | Customer | Status | Amount |
|---|---|---|---|
| INV-1042 | Northwind | Paid | $2,400.00 |
| INV-1041 | Globex | Due | $860.00 |
| INV-1040 | Initech | Paid | $1,120.00 |
| INV-1039 | Umbrella | Paid | $315.00 |
Messages
Password
Pick something you don’t use anywhere else.