---
title: "Text Magnetic Poetry"
description: "Words are fridge-magnet tiles that people drag to write their own line. Each tile snaps and tilts a little."
url: https://gelatinui.com/components/text-magnetic-poetry
markdown_url: https://gelatinui.com/components/text-magnetic-poetry.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/text-magnetic-poetry"
version: "2026-11-15"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Magnetic Poetry

> Words are fridge-magnet tiles that people drag to write their own line. Each tile snaps and tilts a little.

Page: https://gelatinui.com/components/text-magnetic-poetry

## When to use it

Best for: A set of word tiles that people drag into a line, like fridge magnets.

- Use `onValueChange` to read the line people write.
- Use `disabled` to show the tiles with no drag.

## When not to use it

- For a list people sort, use [Sortable List](https://gelatinui.com/components/sortable-list.md).

## Notes for agents

- Each word of `children` becomes a tile.
- The value is the list of words in the line.

## Anatomy

```text
TextMagneticPoetry
├─ TextMagneticPoetryTiles (0..n)
├─ TextMagneticPoetryTile (0..n)
└─ TextMagneticPoetryLine (0..n)
```

## API reference

### TextMagneticPoetry

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | A string (one tile per word, and a line), or the parts. |
| `value` | `readonly string[]` |  | The tiles on the line, in order, by their `value` (controlled). |
| `defaultValue` | `readonly string[]` | EMPTY_LINE | The first line when `value` is not given. Default: empty. |
| `onValueChange` | `function` |  | Called when a drop changes the line. `details.cancel` puts the tile back. |
| `disabled` | `boolean` | false | The tiles stay where they are: no drag, no keys, and no tab stop. Default false. |

### TextMagneticPoetryTiles

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TextMagneticPoetryTile

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `string` |  | The word. |
| `value` | `string` |  | The value of the tile in the line. Default: its word. Keep it unique on the board. |

### TextMagneticPoetryLine

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextMagneticPoetry | `text-magnetic-poetry` |  |  |  |
| TextMagneticPoetryTiles | `text-magnetic-poetry-tiles` |  |  |  |
| TextMagneticPoetryTile | `text-magnetic-poetry-tile` | `data-active`, `data-disabled`, `data-held` |  | `motion-timing` |
| TextMagneticPoetryLine | `text-magnetic-poetry-line` | `data-empty` |  | `motion-timing` |

## Usage

Give the words; read the line with onValueChange.

```tsx title="poem-board.tsx"
import { TextMagneticPoetry, TextMagneticPoetryLine, TextMagneticPoetryTiles } from "@/components/pro/text/text-magnetic-poetry";

export function PoemBoard() {
  return (
    <section className="flex max-w-xl flex-col gap-4 py-12">
      <h2 className="text-lg font-semibold">Write your own line</h2>
      <TextMagneticPoetry aria-label="Magnetic poetry" className="text-lg">
        <TextMagneticPoetryTiles>the moon hums a slow song over quiet city roofs</TextMagneticPoetryTiles>
        <TextMagneticPoetryLine />
      </TextMagneticPoetry>
    </section>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/text-magnetic-poetry
```

It adds 32 registry items: 31 files, 5257 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Sortable List](https://gelatinui.com/components/sortable-list.md)
- [Text Elastic Letters](https://gelatinui.com/components/text-elastic-letters.md)

## Motion

| Part | Motion |
| --- | --- |
| Lift | hover · a held tile lifts with a deeper shadow |
| Drop | fade · the tile snaps into its place in the line |
