# Board

- **[Atoms](/components/)**

Columns of cards a person moves between: drag, or the card's menu from the keyboard. Controlled, so the host's data stays the truth.

## Preview

board.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { Board } from '@/components/klarhimmel/ui/board';

export default function Example() {
  return (
    <Theme theme="brand">
      <Board
        label="Tasks"
        columns={[
          { key: 'todo', title: 'Up next', tone: 'todo', items: [{ id: 'a', title: 'Write the newsletter', who: 'Ida' }] },
          { key: 'done', title: 'Done', tone: 'done', items: [] },
        ]}
        id={(t) => t.id}
        card={(t) => ({ title: t.title, person: t.who })}
        onMove={(t, to) => {}}
        allowed={(t, to) => to !== 'todo'}
      />
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add https://ui.klarhimmel.com/r/board.json
  ```
- **Import**

  ```
  import { Board } from '@/components/klarhimmel/ui/board';
  ```

- **Files**: board.tsx, in components/klarhimmel/ui/. With it: avatar, menu, theme, utils. npm: lucide-react.
- **Render in**: Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

## Props

- **label**: Names the board for screen readers.
- **columns**: Required. tone is a colour such as var(--kh-status-doing) for the dot, number circle and status pill; actions sit right in the header.
- **id**
- **card**: Required. title, number, person, meta, line (a quiet sentence under the title), status, chip { icon, text, overdue }.
- **onOpen**: The whole card opens; the menu has Open too.
- **onMove**: A person moved a card (drag, or the card menu). Controlled: the board changes nothing itself, so the host's data stays the only truth and a move the server refuses never shows as done. The board says and focuses the card once it appears in the new column.
- **allowed**: Whether a card may go to a column; menu items and drop targets that may not are greyed. Default: any other column.
- **onReorder**: A person put a card in a new place in its own column (drag between cards; Felix 28 Oct "organize the lists by dragging cards"). `before` is the card it now sits above, null for last. Controlled like onMove: the host writes the order and the board redraws it. A column takes reorders where `reorderable` says (default: every column, when onReorder is given).
- **reorderable**
- **menu**: Extra items for a card's ⋯ menu, above the moves (an app's 'Move to top').
- **draggable**: Whether a card can be dragged. Default: when the board has onMove. The menu stays the keyboard way.
- **fill**: Fill the height it is given: columns run the full height and each well scrolls on its own. Off: columns are as tall as their cards.
- **words**: Which column a phone opens on: the first in this order that has cards. Default: the columns' order.
- **className**: Extra classes, merged after the component's own.

[Previous](/components/tab-bar)

[Next](/components/status-dot)
