# Radius and Padding

How corner radius and padding pair, from fields to modals.

## Overview

Corners in Tempo are squircles that ease into each edge. Each kind of element has its own radius, from fields and buttons up to modals, and the radius stays the same at every size of that element.

Padding keeps content clear of the curve. Boxes and modals pad by their own radius, and corners step down the scale as layers nest.

## Scale

* **Fields, Buttons, and Alerts (xs):** A 12px corner at every size, padded by at least 16px.
* **Boxes and Tiles (sm):** A 16px corner, padded by 16px, as in a list group.
* **Small Modals (md):** A 24px corner, padded by 24px, for one decision.
* **Medium and Large Modals (lg):** A 32px corner, padded by 32px, for longer tasks.
* **Pills (full):** Icon buttons, avatars, and token chips.

**Do:** Pad a corner by at least its radius, so content sits clear of the curve.

```tsx
<RadiusDemo kind="padded" />
```

**Don't:** Pad a container by less than its radius.

```tsx
<RadiusDemo kind="cramped" />
```

## Squircles

Every corner is a squircle where the browser supports it, and a round corner of the same radius everywhere else.

* **Squircle (corner-shape):** Supporting browsers draw each radius token as a squircle.
* **Fallback (border-radius):** Other browsers draw the same token as a round corner.
* **Circles and Pills (full):** Full radius stays round, so circles keep their shape.

To keep your own circle or pill round, set the round corner shape beside the full radius.

```tsx
import { style } from '@tempoxyz/ds'

namespace styles {
  export const badge = style({ borderRadius: 'full', cornerShape: 'round' })
}
```

## Nested Corners

A layer inside another takes a smaller radius: a modal at 32px holds boxes at 16px, which hold fields at 12px.

**Do:** Step the radius down at each layer, from modal to box to field.

```tsx
<RadiusDemo kind="nested" />
```

**Don't:** Repeat the outer radius on the layers inside it.

```tsx
<RadiusDemo kind="repeated" />
```

## Corner Controls

* **Close and Back Buttons (First line):** Align with the title beside them, not with the corner.

## Bleed

* **Edge-Aligned Controls (Up to the padding):** Lines a text button's label up with the content edge.
* **Full-Bleed Content (Exactly the padding):** Lets rows and tables reach both edges of the box.

## Related

[Layout](/docs/foundations/layout)

Covers the radius, spacing, and shadow scales.

[Surface](/docs/components/surface)

Use for padded boxes and cards.

[Dialog](/docs/components/dialog)

Use for modals.
