Radius
One base radius, five derived steps, what each step is for and the rule for nesting rounded elements.
Corners in NachUI are soft: controls read as pills and surfaces curve like the edge of a device. Every radius comes from a single token,
--radius, which is 1.125rem (18px) in the nachui theme. Change it and the whole scale moves together.The scale
Tailwind's radius utilities are derived from the base with fixed multipliers. The boxes below use the real utilities, so they follow the site's theme.
rounded-sm
0.66x · 12px
Menu items, tooltip
rounded-md
1x · 18px
Buttons, inputs, popovers, toasts
rounded-lg
1.33x · 24px
Cards, dialogs
rounded-xl
1.66x · 30px
Outermost shells: a standalone prompt input, the frame
rounded-2xl
2x · 36px
Drawers and large sheets
| Utility | Formula | At 1.125rem | Use |
|---|---|---|---|
rounded-sm | --radius * 0.66 | 12px | Items inside a surface: menu items, tooltip |
rounded-md | --radius | 18px | Controls, floating surfaces, toasts, callouts |
rounded-lg | --radius * 1.33 | 24px | Primary containers: cards, dialogs |
rounded-xl | --radius * 1.66 | 30px | Outermost shells: a standalone prompt input, frame |
rounded-2xl | --radius * 2 | 36px | Drawers and other large sheets |
Buttons, inputs and select triggers use
rounded-md. At the nachui base that is half the height of a 36px control, so they read as pills; a theme with a smaller base, like microsoft, keeps them squarer without touching a component. rounded-full is kept for things that stay round in every theme: avatars, status dots, icon-only round buttons and chips.The checkbox is the one exception below the scale, at
--radius * 0.33 (6px). At 16px wide, rounded-sm would make it look like a radio.Nesting
An element inside another one always uses a smaller radius than its container. A menu (
rounded-md) holds items with rounded-sm; a card (rounded-lg) holds controls with rounded-md. When the inner corner matches the outer one, the gap between them looks uneven and the inner element seems to bulge.How much smaller depends on the gap between the two edges:
- 8px or less: subtract the gap from the outer radius, so both curves run parallel. A frame (
rounded-xl, 30px) withp-1.5holds panels withrounded-lg(24px), and the active tab sits 3px inside its list, so it usescalc(var(--radius-md) - 3px). - Less than the outer radius: go one step down. A prompt input docked in a card or a chat panel uses
rounded-md. - Equal to or more than the outer radius: the corners no longer read together, so the inner element can repeat the step but never go above it.
rounded-xl is for the outermost shell only and never sits inside a card. rounded-full is exempt.Plan
Pro
Inner radius smaller than the outer one
Plan
Pro
Same radius inside and out
A quick way to check: if you can see the inner corner curve sitting at the same size as the outer one, step it down.
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.