# Letterbox

> A frame that fills whatever box holds it and centres a fixed-ratio surface inside, with bars on the two sides the ratio leaves empty.

```ts
import { Letterbox } from "@sdxc/ui";
```

Fills its container and paints the bars in `--ui-letterbox-bars` (black by default). In a
container with no definite height the frame takes its height from its width at the ratio, so
the surface fills it with no bars. The ratio rides on `--ui-letterbox-ratio`.

## Examples

```tsx
<Letterbox ratio={16 / 9}>
	<Letterbox.Surface mix={css({ fontSize: "4cqh" })}>Slide one</Letterbox.Surface>
</Letterbox>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `ratio?` | `number` | Width divided by height of the surface, as a number so the frame can size the surface with it (`4 / 3`, `1`). |

Also accepts everything in `TagProps<"div">`.


### Letterbox.Surface

The fixed-ratio area inside a Letterbox: as large as fits the frame, centred on both axes, and a size container, so its children size in `cqw`/`cqh` of the surface itself.

Also accepts everything in `TagProps<"div">`.

