> A guide to [@fabiocv/ui](https://ui.fabio.cv/). Every guide is listed at https://ui.fabio.cv/llms.txt.

# Radius

A corner for each kind of thing, and concentric corners inside it.

## Rules

- Pick a radius by what the shape is, not by how large it looks. Anything that holds something else takes `8px`, like every other control.
- A shape inside another takes the outer radius minus the padding between them, so the corners stay concentric. A menu at `8px` with `2px` padding gives its items `6px`, and a toggle group that fills a menu item gives its toggles `4px`. If the result is off the scale, add a token rather than leave the corners mismatched.
- Outside a shape, the same holds: a cut around an `8px` corner with a `2px` gap has a `10px` corner.
- Keep off-scale values to shapes that need them, such as a cutout path.
- `Radius` values are CSS variables, so the inspector shows the token.

## Tokens

| Token        | Value | Code        | Use for                                                                                                                                        |
| ------------ | ----- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `--radius-3` | `3px` | `Radius[3]` | The notches by menu separators and group labels                                                                                                |
| `--radius-4` | `4px` | `Radius[4]` | Tooltips, where a menu notch meets the side, and toggles at the end of a menu item                                                             |
| `--radius-6` | `6px` | `Radius[6]` | Menu items, toggles, a switch's thumb, a tag's sunken square and a toggle group at the end of a menu item, all concentric with what holds them |
| `--radius-8` | `8px` | `Radius[8]` | Buttons, tags, menus, toggle tracks, switches, hover highlights, media, and a drawer's sheet and tabs                                          |

`ImageCard` and `Cutout` start from `6px`, with a `2px` gap, which gives their cuts `8px` corners.

See it at https://ui.fabio.cv/radius/.
