# Flip Text

> Cycles through words with a letter-by-letter flip.

```tsx
import { FlipText } from '@brand-studio/ui';

export default function FlipTextDemo() {
  return (
    <h2 style={{ margin: 0, fontSize: 'clamp(28px, 5vw, 48px)', textAlign: 'center' }}>
      Coffee for <FlipText words={['slow mornings', 'long drives', 'late shifts', 'good company']} />
    </h2>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, FlipText } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { FlipText } from '@brand-studio/ui';
```

```tsx
Coffee for <FlipText words={['slow mornings', 'late shifts']} />
```

## Accessibility

- Screen readers hear every word once, as a list, instead of each change.
- Under reduced motion the words swap without the flip.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `words` | `string[]` | – |
| `interval?` | `number` | `2400` |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/flip-text/
