Skip to content
Klarhimmel UI

Board

Up next1 card

  • Ida Lindqvisttoday

    Write the newsletter

In progress1 card

  • Ida Lindqvisttoday

    Photograph the rooms

Needs your OK1 card

  • Ida Lindqvisttoday

    Update the opening hours

Done0 cards

  • Nothing here
npx shadcn add https://ui.klarhimmel.com/r/board.json
DetailsAbout, usage, props and more

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

Up next1 card

  • 12Ida Lindqvist2 days ago
    Up nextFri 20 Nov

In progress1 card

  • 9Teamyesterday
    In progress2/5

Needs your OK1 card

  • 7Teamtoday
    Needs your OK

Done1 card

  • 4Ida Lindqvist5 days ago
    Done
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

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

PropTypeDefaultDescription
labelstringrequiredNames the board for screen readers.
columnsBoardColumn<T>[]requiredRequired. tone is a colour such as var(--kh-status-doing) for the dot, number circle and status pill; actions sit right in the header.
idstringrequired
cardBoardCardFieldsrequiredRequired. title, number, person, meta, line (a quiet sentence under the title), status, chip { icon, text, overdue }.
onOpenvoid-The whole card opens; the menu has Open too.
onMovevoid-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.
allowedboolean-Whether a card may go to a column; menu items and drop targets that may not are greyed. Default: any other column.
onReordervoid-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).
reorderableboolean-
menu{ key: string; title: ReactNode; go: () => void }[]-Extra items for a card's ⋯ menu, above the moves (an app's 'Move to top').
draggableboolean-Whether a card can be dragged. Default: when the board has onMove. The menu stays the keyboard way.
fillbooleanfalseFill 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.
wordsPartial<BoardWords>-Which column a phone opens on: the first in this order that has cards. Default: the columns' order.
classNamestring-Extra classes, merged after the component's own.