# Text roll

A status line that changes in place: the old text leaves upward as the new one rises in.

Live variants: https://design.arcadia.is/components/text-roll

```tsx
import { TextRoll } from "@arcadia/ui";
```

```tsx
import { useState } from "react";
import { Button, TextRoll } from "@arcadia/ui";

function Rolling() {
  const [i, setI] = useState(0);
  return (
    <div {...sx("cmp-bar", cmp.bar)}>
      <span {...sx("cmp-status", cmp.status, cmp.statusUi)} role="status"><TextRoll text={LINES[i]!} /></span>
      <Button variant="secondary" size="sm" onClick={() => setI((i + 1) % LINES.length)}>Next</Button>
    </div>
  );
}
```

## Accessibility

The current text is in the page once, for a screen reader; the copies the motion draws are hidden from it. Put the live-region role on the container, as the examples do with `role="status"`, so each change is read once. Reduced motion swaps the text in place with no motion and no mask, whichever arrival the product set.

## API reference

### TextRoll

- `text` (`string`, required): The line. When it changes, the old text leaves and the new one arrives by the motion.
- `motion` (`"roll" | "cascade" | "scramble"`, default `"roll"`): How the new line arrives. All values crossfade in place. Default: `roll`.
- `wrap` (`boolean`, default `false`): A label that may not fit its container wraps onto more lines, instead of one line cut at its edge.
- `rootStyle` (`RootStyle`): Typed StyleX override: where the line sits.
- `children` (`(text: string) => ReactNode`): Draws a line's visible text (default: the text itself): wrap it in a `Shimmer` while the status is live.

Rest props go to `HTMLAttributes<HTMLSpanElement>`.
