# Box

A container with token-only padding, background, radius, border and shadow.

- Family: layout
- Import: `import { Box } from "@senvenli/react/layout";`
- Page: https://design.senvenli.com/docs/components/box
- JSON: https://design.senvenli.com/docs/components/box.json

## Example: A padded surface

Padding, ground and radius from tokens.

```tsx
import { Text } from "@senvenli/react/display";
import { Box, Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Box padding="space-300" background="surface-sunken" radius="large">
      <Stack space="space-050">
        <Text weight="medium">Billing address</Text>
        <Text tone="subtle">1200 Market Street, Philadelphia, PA 19107</Text>
      </Stack>
    </Box>
  );
}
```

## Examples

### With a border

A divided region; `as` gives it the right element.

```tsx
import { Text } from "@senvenli/react/display";
import { Box, Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Box as="section" aria-label="Order notes" padding="space-200" radius="medium" border>
      <Stack space="space-050">
        <Text weight="medium">Order notes</Text>
        <Text tone="subtle">Leave the parcel with the front desk.</Text>
      </Stack>
    </Box>
  );
}
```

### Raised

A raised ground with its shadow, for content that floats above the page.

```tsx
import { Text } from "@senvenli/react/display";
import { Box, Stack } from "@senvenli/react/layout";

export default function Example() {
  return (
    <Box paddingInline="space-300" paddingBlock="space-200" background="surface-raised" radius="large" shadow="raised">
      <Stack space="space-050">
        <Text weight="medium">Invoice INV-2041</Text>
        <Text tone="subtle">Due March 31, 2026</Text>
      </Stack>
    </Box>
  );
}
```

## Guidelines

### When to use it

- Giving a group of content padding or a surface without a card's semantics.

### Use something else when

- [card](https://design.senvenli.com/docs/components/card.md): The content is one object with a title.

## Accessibility

Built in:

- Renders a plain element; pass `as` for semantics.

You provide:

- The right element through `as` (section, nav, aside…) when it has a role.

## API reference

### Box

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| padding | `Space` |  | no |  |
| paddingInline | `Space` |  | no |  |
| paddingBlock | `Space` |  | no |  |
| background | `Background` |  | no |  |
| radius | `Radius` |  | no |  |
| shadow | `Shadow` |  | no |  |
| border | `Border` |  | no |  |
| as | `LayoutElement` | `"div"` | no |  |

Also takes 375 standard DOM and ARIA attributes (id, aria-label, event handlers…).

### Tokens it reads

`--ds-background-brand-subtle`, `--ds-background-danger`, `--ds-background-information`, `--ds-background-neutral`, `--ds-background-selected`, `--ds-background-success`, `--ds-background-warning`, `--ds-border`, `--ds-border-bold`, `--ds-radius-full`, `--ds-radius-large`, `--ds-radius-medium`, `--ds-radius-small`, `--ds-shadow-overflow`, `--ds-shadow-overlay`, `--ds-shadow-raised`, `--ds-space-0`, `--ds-space-025`, `--ds-space-050`, `--ds-space-075`, `--ds-space-100`, `--ds-space-1000`, `--ds-space-150`, `--ds-space-200`, `--ds-space-250`, `--ds-space-300`, `--ds-space-400`, `--ds-space-500`, `--ds-space-600`, `--ds-space-800`, `--ds-surface`, `--ds-surface-overlay`, `--ds-surface-raised`, `--ds-surface-sunken`

## Related

- [stack](https://design.senvenli.com/docs/components/stack.md)
- [grid](https://design.senvenli.com/docs/components/grid.md)
