Borders
Three width tokens and three color tokens draw every line in the library. Use them together so a border of your own matches the ones around it and follows the theme and the mode.
| Token |
Default |
Used for |
--border-width-thin | 1px | Dividers, table rows, outlined cards |
--border-width-medium | 2px | Table header rules, the link focus outline |
--border-width-thick | 4px | The accent edge of a status message |
--color-border | Light gray, or dark gray in dark mode | The default line |
--color-border-strong | One step darker | A line that needs to stand out |
--color-border-subtle | One step lighter | A faint separator |
.fare-table { border: var(--border-width-thin) solid var(--color-border); border-radius: var(--radius-m);}
These border colors are decorative and are not meant to meet a contrast ratio. Form controls draw their edge with --control-border, which is darker so that the control can be found. For an edge that reads as a faint line plus a little lift, see --shadow-flush in Shadows.
The radius scale
Every rounded corner reads one of these tokens. Change the tokens and buttons, cards, inputs, badges and dialogs change together.
| Token |
Default |
Used by |
--radius-xs | 0.125rem (2px) | Fine details such as markers |
--radius-s | 0.25rem (4px) | Checkboxes |
--radius-m | 0.5rem (8px) | Buttons, text inputs, img.rounded |
--radius-l | 0.75rem (12px) | <layout-card>, <dialog> |
--radius-xl | 1rem (16px) | Yours to use for larger panels |
--radius-2xl | 1.5rem (24px) | Yours to use for the largest surfaces |
--radius-full | 9999px | Pills and circles: radio buttons, img.circle |
Changing the corners
Set the tokens on :root for the whole page, or on any element for one region.
:root { --radius-xs: 0px; --radius-s: 0px; --radius-m: 0px; --radius-l: 0px; --radius-xl: 0px; --radius-2xl: 0px;}
A theme does the same thing. Swiss sets every radius to zero, Classic makes them small, and Kawaii and Claymorphism make them large. If you want a theme's corners along with its colors and type, pick the theme.
One case needs care in a region. Text inputs take their radius from --input-radius, which is computed from --radius-m on :root. Inside a region, set --input-radius as well as --radius-m.
Corners inside corners
A rounded box inside a rounded box looks right when the inner radius is the outer radius minus the padding between them. --radius-inner holds that value. Set the parent's radius in --_radius and its padding in --_inset, and use --radius-inner on anything inside it.
.ticket { --_radius: var(--radius-xl); --_inset: var(--size-s); padding: var(--_inset); border-radius: var(--_radius);} .ticket > p { border-radius: var(--radius-inner);}
The last panel in the demo above is built this way. The result stops at zero when the padding is larger than the radius. Without --_radius the token starts from --radius-m, and without --_inset it subtracts nothing. The two properties inherit, so a box nested a level further down should set its own pair.