Radius
Three roles, one base, and two rules that keep nested corners concentric at any radius.
Every corner belongs to a role. Controls are buttons, fields, selects, tabs and small marks like badges and checkboxes. Surfaces are cards, dialogs, drawers, popovers, toasts and tooltips. Items are the rows of menus, lists, trees and navigation. Each role multiplies its own value, so you can make every corner sharper or rounder, or round the controls and square the cards. Drag one below and watch the others stay put.
Card
A surface
Roles
| Class | Factor | Used by |
|---|---|---|
rounded-control-3xs | ×0.2 | Checkbox, Kbd xs |
rounded-control-2xs | ×0.6 | Badge xs–sm, Kbd sm–md, date and time segments |
rounded-control-xs | ×0.8 | 28px controls |
rounded-control-sm to -lg | ×1 | 32 to 40px controls |
rounded-control-xl | ×1.4 | 48px controls |
rounded-surface-xs | ×0.8 | Tooltip, small alerts |
rounded-surface-sm | ×1 | Card xs–sm |
rounded-surface-md | ×1.4 | Card md, popovers, toasts |
rounded-surface-lg | ×1.8 | Card lg, dialogs, drawers |
rounded-surface-xl | ×2.2 | Card xl |
rounded-item-xs to -xl | ×0.8, ×1, ×1.4 | rows by height, like controls |
A factor multiplies the role's own value, which follows --radius until you set it. Every side and corner variant exists too: rounded-t-surface-lg, rounded-s-control-md. Pills, like Switch, Radio, Slider and Avatar, stay rounded-full whatever the radius.
Nested corners
A part close to its container's corner keeps the two corners concentric, and two utilities do the arithmetic. Drag the radius and watch both circles keep one centre:
rounded-inset-<radius>/<inset>for a part inside a frame, like the button in an InputGroup or the close button of a toast. It takes the outer radius less the inset, but never less than half the outer radius: square at--radius: 0, exactly concentric at a large radius, and never a square button next to round ones in between.rounded-outset-<radius>/<inset>for a container around items, like a menu or the track of pill tabs. It takes the items' radius plus the padding, so the items keep the radius they have anywhere else. Square items make a square container.
The radius is a role step (control-md), a variable ((--frame-radius)) or a length ([12px]). The inset is a spacing step (/1.5 is 6px), a variable or a length.
<div class="rounded-surface-md p-1">
<img class="rounded-inset-surface-md/1" />
</div>
A part further from the corner than the corner's radius, like the close button of a dialog, isn't concentric with anything. It takes its own role.
Customising
Set a role's value on :root to change it everywhere, or on any element to change it below that element:
:root {
--radius: 0.5rem;
--control-radius: 9999px; /* pill buttons and fields */
--surface-radius: 0; /* square cards and dialogs */
}
The theme customiser in the header sets the same values, and Copy CSS writes the ones you changed.
| Variable | Default | Description |
|---|---|---|
| --radius | 0.5rem | The base. Every role follows it until its own value is set. |
| --control-radius | var(--radius) | Buttons, fields, selects, tabs and small marks. |
| --surface-radius | var(--radius) | Cards, dialogs, drawers, popovers, toasts and tooltips. |
| --item-radius | var(--radius) | Rows in menus, lists, trees and navigation. |
Next
- Accessibility: small controls that are still easy to tap.
- Theming: colours, tones and surfaces.