<!-- generated by scripts/gen-docs.mjs from docs/system/radius.md. Edit the source and rerun. -->
# Radius

## Description

How round each corner is. The radius follows the element's height: small marks take 4 to 6px, 32 to 44px controls take 10 or 12px, and surfaces take 16 to 24px. A shape inside another is concentric: its radius is the outer radius minus the padding between them. By default only a switch, an avatar, a radio mark and a thin progress bar are fully round; a status mark, a timeline's among them, is a rounded square.

Controls have their own corner tokens, so a product can make them round without touching its cards, menus and popups. `--r-control` is every one-line control: a button, a field, a select trigger, a pill, a toggle, a nav item, a page step. `--r-track` is a segmented control's or tabs' track, and `--r-tag` a tag or badge. The parts inside follow on their own: `--r-control-sm` is 4px in from a control, `--r-thumb` 4px in from a track.

### Pill corners

Set four tokens and every control, track, tag and tooltip is round, as in a search-led product:

```css
.cobalt {
  --r-control: 999px;
  --r-track: calc(var(--control) / 2);
  --r-tag: 999px;
  --r-tooltip: calc(0.5lh + var(--spacing));
}
```

A track takes half a control's height instead of 999px, so lying flat it is round and standing up as vertical tabs it keeps concentric corners round its thumbs. A calendar day takes the rounder of a menu row's corner and a control's, so its days turn round too. A field box whose chips can wrap (the input group, a combobox with chips, the invite field) takes `--r-field`, which stops at half a control's height: a pill at one line, the same corner when it grows to two. A tooltip takes half a one-line tooltip's height (its line plus its 4px of padding above and below, halved), so one line is a full pill and a tooltip that wraps keeps that 12px corner. A textarea, a menu row, a card, a popup and a dialog keep their steps: a multi-line box drawn as a capsule wastes its corners. In the docs, Customize, Corners, Pill shows it on every page.

## Tokens

<!-- tokens:start corners -->
| Token | Light | Dark | Role |
|---|---|---|---|
| `--radius` | `var(--r-lg)` | same | shadcn's base corner, which its cards and menus step from, so it stays a corner even when controls are pills |
| `--r-xs` | `4px` | same | A checkbox: a 16px box with slightly rounded corners |
| `--r-sm` | `6px` | same | A small corner: a key cap, a tag (see --r-tag) |
| `--r-md` | `8px` | same | A tooltip |
| `--r-lg` | `10px` | same | A control's corner (see --r-control), a textarea, a calendar day, and a row in a menu, select or list popup, which sits --pad-popup inside the popup's --r-3xl |
| `--r-xl` | `calc(var(--r-md) + 4px)` | same | A segmented control's or tabs' track (see --r-track), a list row on a page, a date tile: the thumb's --r-md plus the track's 4px padding, so the two stay concentric |
| `--r-2xl` | `16px` | same | A card, a sheet |
| `--r-3xl` | `calc(var(--r-lg) + var(--pad-popup))` | same | A menu, a popover, a select popup, a date picker, a toast: a row's corner (a control's, --r-lg) plus the popup's padding, so the two stay concentric and the popup follows the corner setting, 16px by default like a card |
| `--r-4xl` | `24px` | same | A dialog |
| `--r-control` | `var(--r-lg)` | same | A one-line control: a button, a field, a select trigger, a pill, a toggle, a nav item, a page step. 999px rounds them fully |
| `--r-control-sm` | `calc(var(--r-control) - 4px)` | same | A small control or chip 4px inside a field: a 28px icon button, a combobox chip |
| `--r-field` | `min(var(--r-control), calc(var(--control) / 2))` | same | A field box that can grow past one line as chips wrap (input group, combobox, invite field): fully round at one line under pill corners, and the same corner once it grows, never a capsule |
| `--r-track` | `var(--r-xl)` | same | A segmented control's or tabs' track |
| `--r-thumb` | `calc(var(--r-track) - 4px)` | same | The option inside a track, 4px in, so the two stay concentric |
| `--r-tag` | `var(--r-sm)` | same | A tag, a badge |
| `--r-tooltip` | `var(--r-md)` | same | A tooltip and the chart's tooltip; under pill corners half a one-line tooltip's height (calc(0.5lh + var(--spacing))), so one line is fully round and two never make a capsule |
| `--r-bubble` | `var(--r-2xl)` | same | A message bubble, a picture group and a file in a thread |
| `--r-bubble-joined` | `var(--r-sm)` | same | A bubble's corner that faces the next bubble of the same run, on the sender's side |
| `--r-bubble-inner` | `calc(var(--r-bubble) - 4px)` | same | A quote inside a bubble, 4px in from its edge, so the two stay concentric |
| `--r-composer` | `calc(min(var(--r-control), var(--control-sm) / 2) + var(--pad-composer))` | same | The message composer: its 32px buttons' corner plus the padding around them, so a pill composer stays concentric with round buttons and never turns into a capsule |
<!-- tokens:end corners -->

## Specimens

The showcase draws one grey square per step with its token name, then one card twice, with default and with Pill corners.

## Usage

| When                                                      | Use            |
| --------------------------------------------------------- | -------------- |
| A checkbox                                                | `rounded-xs`   |
| A button, a pill, a toggle, a nav item, an input, a select trigger, a page step | `rounded-(--r-control)` |
| A 28px icon button or a chip inside a field               | `rounded-(--r-control-sm)` |
| A segmented or tabs track                                 | `rounded-(--r-track)` |
| The option inside a segmented control or tabs             | `rounded-(--r-thumb)` |
| A badge, a tag                                            | `rounded-(--r-tag)` |
| Inline code, a key cap, a skeleton line                   | `rounded-sm`   |
| A tooltip                                                 | `rounded-md`   |
| A textarea                                                | `rounded-lg`   |
| A menu row, a select option, a calendar day               | `rounded-lg`   |
| A card, a rail card, a sheet                              | `rounded-2xl`  |
| A dropdown, a select popup, a popover, a toast            | `rounded-3xl`  |
| A dialog                                                  | `rounded-4xl`  |
| A switch, an avatar, a radio mark, a progress bar         | `rounded-full` |
| A status mark; a timeline mark, its SVG `rect` at 4px      | `rounded-xs`   |

- `rule/radius-steps-only`: When a corner needs a radius, use one of the eight steps or `rounded-full` instead of an arbitrary value, because the arbitrary radii in the source app (18px, 6px, 5px, 2px) came from one-off components and drifted from their neighbours. Evidence: app 464/468 radius classes in tsaglobal are steps, apps/web/app (survey 2026-10-16); app 4/4 radius tokens in adv-atlas are 8, 12, 16 or 20px, web/css/tokens.css. Check: lint rule/arbitrary-value (scripts/check-system.mjs).
  - Don't: `<div className="rounded-[18px]">`
  - Do: `<div className="rounded-2xl">`
- `rule/radius-layers-step-up`: When a surface floats over another, give it a larger radius than what it floats over (card 2xl, menu 3xl, dialog 4xl), because equal radii on nested layers read as one flat sheet and a smaller one reads as a cut-out. Evidence: app 3/3 floating layers in tsaglobal step up from the card (ui/dropdown-menu.tsx 3xl, ui/dialog.tsx 4xl, components/rail-card.tsx 2xl); principle heuristic: aesthetic and minimalist design, nested edges stay legible. Check: review.
  - Don't: `<PopoverContent className="rounded-lg">`
  - Do: `<PopoverContent>`
- `rule/radius-nested-is-concentric`: When a shape sits inside another with padding between them, give the inner shape the outer radius minus that padding, such as a 12px track around 8px options with 4px between, because equal radii on nested shapes make the gap thinner at the corners than along the sides. Evidence: principle platform: Apple's concentric corners in its design guidance; single use `registry/cobalt/ui/segmented-control.tsx:68-82`, the track and its thumb. Check: review.
  - Don't: `<div className="rounded-xl p-1"><button className="rounded-xl" /></div>`
  - Do: `<div className="rounded-xl p-1"><button className="rounded-md" /></div>`
- `rule/radius-round-is-rare`: When something is `rounded-full` or a circle, it is a Switch, an Avatar, a RadioGroup mark or a Progress bar; a button, a pill, a segmented control and a nav item take `--r-control` or `--r-track`, so they turn round together or not at all, because one round control beside 10px fields and buttons makes one toolbar look like two systems. Evidence: person D38; principle heuristic: consistency and standards, one toolbar reads as one system. Check: review.
  - Don't: `<span className="rounded-full bg-muted px-2">beta</span>`
  - Do: `<Badge>Beta</Badge>`
  - A status mark is never a circle: the unread and live marks are 10px at `rounded-xs`, and the timeline mark is an 11px rounded square with the same 4px corner, drawn as an SVG `rect` so its 1.5px edge stays sharp (`registry/cobalt/ui/timeline.tsx:21-30`).

## Accessibility

Radius changes nothing a screen reader hears. The focus outline follows the control's own radius (`outline` honours `border-radius`), so each control's ring has its own shape; checked in the showcase by keyboard in both themes.

## Not tokens

- `rounded-full` (9999px) is a keyword, not a token.
- The corner of a bottom sheet's top edge is the same `--r-2xl`; it is not a separate value.
