# Carousel

Supply UI 1.1.0. Showing things.

A row to swipe through; each child is one item. `controls` adds previous and next buttons, `indicators` a dot for each page. Inside a card or a dialog it runs to the box's edges by itself (the first item still lines up with the text, and the last keeps the same room); `bleed="2rem"` does the same in a box of your own. Where more slides continue, the row fades into whatever is behind it (a transparency mask, so it works on any background), on the side that has more, and clears at the ends

A row to swipe through. Each child is one item. It swipes, drags with a mouse (an open hand shows it can) and scrolls like any row, pages with the arrow keys, and can show buttons (`controls`), dots (`indicators`), go round (`loop`) or turn by itself (`defaultPlaying`). Name it: `aria-label="Photos"`.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `bleed` | `boolean \| string` |  | Let the row run past the padding of the box it sits in, to its edges, instead of being cut at the padding line. The first item still lines up with the text. Inside a card or a dialog it always does this, by itself; use `bleed` for any other box, with its padding as a length ("var(--ui-pad-lg)", "2rem"). |
| `children` | `ReactNode` |  | What goes inside. |
| `className` | `string` |  | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
| `controls` | `boolean` |  | Previous and next buttons under the row. |
| `indicators` | `boolean` |  | A dot for each page. |
| `item` | `string` |  | The width of one item: "80%", "18rem". |
| `style` | `CSSProperties` |  | Inline styles on the outer element; for CSS variables such as a height, not for colours. |

It also takes the 295 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## Without React

Classes: `ui-carousel` + `--item`

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/carousel.css`, `parts/carousel.css`, besides the ones every page loads.

## In the examples

- Room by room: Swipe through the finished rooms, or use the arrows (https://www.supply.family/ui/#scene-rooms)

## Showing things: notes

**States.** Lists, tables and boards have three more states besides their content: empty (`Empty`, with the first action inside), loading (`Skeleton`) and failed (`Alert tone="danger"`). A chosen row shows in ink, never in the brand colour.

**Do**
- Put numbers, dates and codes in `ui-mono` (in a table cell, `ui-num`, which also aligns them).
- Let a `Table` turn into blocks on a phone; give it `scroll` only when it is read down its columns.
- Show a status in words and colour together (`Badge tone="success"` with "Paid"), never colour alone.

**Don't**
- Don't put a card round a `Table`, `List`, `Cells`, `Calendar` or `Empty`: they draw their own box.
- Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
- Don't use the status colours (success, warning, danger, info) for anything but those meanings.
