Primary
Secondary
Tertiary
Outline
Ghost
Danger
Small
Medium (default)
Large
With icons
Icon only buttons
All buttons disabled
Group disabled, but one button overrides
Selected:{" "} {selectedKeys.size > 0 ? [...selectedKeys].join(", ") : "None"}
Status: {isSelected ? "Selected" : "Not selected"}
Menu is: {open ? "open" : "closed"}
Selected: {selectedItems.length > 0 ? selectedItems.join(", ") : "None"}
Dropdown is: {open ? "open" : "closed"}
Jane Doe
jane@example.com
Selected: {selectedItems.length > 0 ? selectedItems.join(", ") : "None"}
None
Single
Multiple
Primary
Secondary
Selected:
Selected: {color.toString("hex")}
Current color:{" "} {color ? color.toString("hex") : "(empty)"}
{color.toString(colorSpace)}
Edit individual HSL channels:
Selected: {color.toString("hex")}
Current color: {color.toString("hsl")}
Current color: {color.toString("hsl")}
Current color: {color.toString("rgb")}
Selected: {value.toString("hex")}
Current hue: {color.toString("hsl")}
Current value: {value}
> ); } ``` ### Custom Value Formatting ```tsx import { Slider, Label } from '@darkcode-ui/react';Switch is {isSelected ? "on" : "off"}
Drag rows to reorder. Use keyboard (Enter to grab, arrows to move, Enter to drop).
{enabledCount} of {features.length} enabled · Total effort: {totalPoints} pts
A list of all the users in your account including their name, title, email and role.
| ` of this column | | `cellClassName` | `string` | - | Additional className for every ` | ` of this column |
| `pinned` | `'start' \| 'end'` | - | Pin this column. Requires numeric `width` or `minWidth` |
### DataGridReorderEvent
Event object passed to the `onReorder` callback.
| Property | Type | Description |
| --------------- | ------------------------------------------------- | ----------------------------------------------------- |
| `keys` | `Set
{people.map((person) => (
);
}
function KanbanColumn({
column,
kanban,
renderDropIndicator,
}: {
column: Column;
kanban: UseKanbanReturn
{(["sm", "md", "lg"] as const).map((size) => (
);
}
```
## Related Components
* **List View**: Single-column interactive list with selection and item actions
* **Table**: Structured data display in rows and columns
* **DropZone**: Drag-and-drop file upload area with a file list preview
## Styling
### Passing Tailwind CSS classes
Every part accepts a `className`, and the colored status dot reads the `--kanban-indicator-color`
custom property:
```tsx
{size} [Learn more](https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes). ```css @layer components { .kanban { --kanban-column-min-width: 320px; --kanban-column-gap: 24px; } .kanban__card-content { @apply shadow-none ring-1 ring-border; } } ``` DarkCode UI follows the [BEM](https://getbem.com/) methodology to ensure component variants and states are reusable and easy to customize. ### CSS Classes The Kanban component uses these CSS classes ([View source styles](https://github.com/DarkCode-Developers/darkcode-ui/blob/main/packages/styles/components/kanban.css)): #### Base & Size Classes * `.kanban` - Root board container. CSS grid with horizontal auto-flow and snap scrolling. * `.kanban--sm` - Small size. Narrower columns (`240px`), tighter gap (`12px`). * `.kanban--md` - Medium size (default). Standard columns (`280px`), default gap (`16px`). * `.kanban--lg` - Large size. Wider columns (`320px`), spacious gap (`20px`). #### Element Classes * `.kanban__column` - Individual column section. * `.kanban__column-body` - Visual container for the card list and footer actions. * `.kanban__column-header` - Header area with indicator, title, count, and actions. * `.kanban__column-actions` - Hover-reveal action buttons inside the header. * `.kanban__column-indicator` - Colored status dot (when empty) or icon container (with children). * `.kanban__column-title` - Column heading text (`text-sm font-semibold`). * `.kanban__column-count` - Item count badge (`text-xs text-muted`). * `.kanban__card` - Outer card wrapper. Handles focus ring, cursor, and drag opacity. * `.kanban__card--sm`, `.kanban__card--md`, `.kanban__card--lg` - Card size variants. * `.kanban__card-content` - Inner Motion wrapper carrying background, radius, shadow, and layout. * `.kanban__card-content--sm`, `.kanban__card-content--md`, `.kanban__card-content--lg` - Content size variants. * `.kanban__card-list` - Scrollable GridList container with vertical gap between cards. * `.kanban__scroll-shadow` - Optional ScrollShadow wrapper for constrained, scrollable columns. * `.kanban__drop-indicator` - Custom drop indicator with animated height via `--kanban-drop-height`. * `.kanban__drag-handle` - Grip button, screen-reader-only by default. Reveals on focus. * `.kanban__empty` - Empty state placeholder centered inside an empty column. #### Interactive States * `.kanban__card:hover .kanban__card-content` - applies `shadow-sm`. * `.kanban__card[data-selected="true"] .kanban__card-content` - applies `bg-accent-soft`. * `.kanban__card[data-dragging]` - reduced opacity. * `.kanban__card[data-focus-visible="true"]` - focus ring with `ring-2`. * `.kanban__column-header:hover .kanban__column-actions` - opacity transitions to 1. * `.kanban__drop-indicator[data-drop-target]` - border and animated height. #### CSS Variables * `--kanban-column-min-width` - Minimum column width (default: `280px`). * `--kanban-column-gap` - Gap between columns (default: `16px`). * `--kanban-column-height` - Column height reference (default: `480px`). * `--kanban-drop-height` - Drop indicator placeholder height. Set automatically by `useKanbanCardPlaceholder`. * `--kanban-indicator-color` - Color of the column status dot. ## API Reference ### Kanban The root board container. Wraps children in a horizontal `ScrollShadow`. | Prop | Type | Default | Description | | ------ | ---------------------- | ------- | ------------------------------------------------------------------- | | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Size variant controlling card padding, font size, and column width. | Also supports all [ScrollShadow](/docs/react/components/scroll-shadow) props (except `size`). ### Kanban.CardList The scrollable card list backed by React Aria `GridList`. | Prop | Type | Default | Description | | ------------------ | ---------------------------------- | -------- | -------------------------------------------------------- | | `selectionMode` | `"none" \| "single" \| "multiple"` | `"none"` | Selection behavior for cards. | | `renderEmptyState` | `() => ReactNode` | — | Custom empty state content when the column has no cards. | | `dragAndDropHooks` | `DragAndDropHooks` | — | The hooks returned by `useKanbanColumn`. | Also supports all React Aria [GridList](https://react-spectrum.adobe.com/react-aria/GridList.html) props. ### Kanban.Card An individual draggable card. Wraps content in a Motion `layout` animation. Backed by React Aria `GridListItem`. | Prop | Type | Default | Description | | ------------------ | ------------------------------------------- | ------- | --------------------------------------------------------------------------- | | `textValue` | `string` | — | Accessible text value for the card. | | `contentClassName` | `string` | — | Class names for the inner Motion content surface. | | `children` | `ReactNode \| ((renderProps) => ReactNode)` | — | Card content. May be a render function receiving GridListItem render props. | Also supports all React Aria [GridListItem](https://react-spectrum.adobe.com/react-aria/GridList.html#gridlistitem) props. ### Kanban.DropIndicator Visual drop indicator shown during drag operations. | Prop | Type | Default | Description | | -------- | ------------ | ------- | ---------------------------------------------------------------------------------------------------- | | `target` | `DropTarget` | — | The drop target provided by React Aria. | | `height` | `number` | — | Height of the placeholder in pixels. Typically the dragged card's height via `--kanban-drop-height`. | ### Kanban.DragHandle Grip button for keyboard-accessible dragging. Screen-reader-only by default; reveals on focus. Uses `slot="drag"`. Also supports all React Aria [Button](https://react-spectrum.adobe.com/react-aria/Button.html) props. ### Kanban.ScrollShadow Optional scroll wrapper for constrained column heights. Use with `max-h-[...]` to enable vertical scrolling within a column. Also supports all [ScrollShadow](/docs/react/components/scroll-shadow) props. ### Other Parts `Kanban.Column`, `Kanban.ColumnHeader`, `Kanban.ColumnBody`, `Kanban.ColumnActions`, `Kanban.ColumnIndicator`, `Kanban.ColumnTitle`, and `Kanban.ColumnCount` are styling wrappers that render `section`, `header`, `div`, `h3`, and `span` elements respectively and accept standard HTML props. ### useKanban Manages the shared list data for the entire board. ```tsx const kanban = useKanban({ initialItems: tasks, getColumn: (item) => item.status, setColumn: (item, column) => ({ ...item, status: column }), }); ``` | Option | Type | Default | Description | | -------------- | -------------------------------- | ------------------ | ------------------------------------------------------------ | | `initialItems` | `T[]` | — | Items to populate the board with. | | `getColumn` | `(item: T) => string` | — | Return the column identifier for a given item. | | `setColumn` | `(item: T, column: string) => T` | — | Return a copy of the item assigned to a new column. | | `dragType` | `string` | `"kanban-item-id"` | Custom drag type for transferring item keys between columns. | | `getKey` | `(item: T) => string \| number` | `item.id` | Derive a unique key from each item. | **Returns:** `{ list, addItem, removeItem, moveItem, updateItem, getColumn, setColumn, getKey, dragType }`. ### useKanbanColumn Provides filtered items and drag-and-drop hooks for a single column. ```tsx const { items, dragAndDropHooks } = useKanbanColumn(kanban, "in-progress", { renderDropIndicator, }); ``` | Option | Type | Default | Description | | ----------------------------- | -------------------------- | ------- | ---------------------------------------------- | | `kanban` | `UseKanbanReturn [Learn more](https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes). ```css @layer components { .number-value { @apply items-baseline gap-0.5; } .number-value__value { @apply font-semibold tabular-nums; } .number-value__prefix, .number-value__suffix { @apply text-muted; } } ``` DarkCode UI follows the [BEM](https://getbem.com/) methodology to ensure component variants and states are reusable and easy to customize. ### CSS Classes The NumberValue component uses these CSS classes ([View source styles](https://github.com/DarkCode-Developers/darkcode-ui/blob/main/packages/styles/components/number-value.css)): #### Base Classes * `.number-value` - Base inline-flex wrapper #### Element Classes * `.number-value__prefix` - Text before the formatted number * `.number-value__value` - The formatted number * `.number-value__suffix` - Text after the formatted number ## API Reference ### NumberValue The root component. Formats and displays a number using locale-aware `Intl.NumberFormat`. | Prop | Type | Default | Description | | ----------------------- | ------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------- | | `value` | `number` | - | **Required.** The numeric value to format | | `style` | `'decimal' \| 'currency' \| 'percent' \| 'unit'` | `'decimal'` | Formatting style | | `currency` | `string` | - | Currency code (e.g. `"USD"`). Required when `style` is `"currency"` | | `unit` | `string` | - | Unit type (e.g. `"degree"`). Required when `style` is `"unit"` | | `notation` | `'standard' \| 'compact' \| 'scientific' \| 'engineering'` | `'standard'` | Notation style | | `signDisplay` | `'auto' \| 'always' \| 'exceptZero' \| 'never'` | - | Controls when the sign is displayed | | `minimumFractionDigits` | `number` | - | Minimum number of fraction digits | | `maximumFractionDigits` | `number` | - | Maximum number of fraction digits | | `locale` | `string` | - | Override the locale from the nearest I18nProvider | | `formatOptions` | `Intl.NumberFormatOptions` | - | Format options passed directly to the formatter. Overrides individual convenience props | | `children` | `React.ReactNode \| ((formatted: string) => React.ReactNode)` | - | Prefix/Suffix sub-components or a render function receiving the formatted string | Also supports all native `span` HTML attributes except `children` and `style`. ### NumberValue.Prefix Text displayed before the formatted number. | Prop | Type | Default | Description | | ---------- | ----------------- | ------- | ----------- | | `children` | `React.ReactNode` | - | Prefix text | Also supports all native `span` HTML attributes. ### NumberValue.Suffix Text displayed after the formatted number. | Prop | Type | Default | Description | | ---------- | ----------------- | ------- | ----------- | | `children` | `React.ReactNode` | - | Suffix text | Also supports all native `span` HTML attributes. Selected:{" "} {selectedKeys === "all" ? "All" : selectedKeys.size > 0 ? Array.from(selectedKeys).join(", ") : "None"} [Learn more](https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes). ```css @layer components { .table-root { @apply relative grid w-full overflow-clip; } .table__header { @apply bg-gray-100; } .table__column { @apply px-4 py-2.5 text-left text-xs font-medium text-gray-600; } .table__row { @apply bg-white border-b border-gray-200; } .table__cell { @apply px-4 py-3 text-sm; } .table__footer { @apply flex items-center px-4 py-2.5; } } ``` DarkCode UI follows the [BEM](https://getbem.com/) methodology to ensure component variants and states are reusable and easy to customize. ### CSS Classes The Table component uses these CSS classes ([View source styles](https://github.com/DarkCode-Developers/darkcode-ui/blob/main/packages/styles/components/table.css)): #### Base Classes * `.table-root` - Root container (named `table-root` instead of `table` because `table` is a built-in Tailwind CSS utility class for `display: table`) * `.table__scroll-container` - Horizontal scroll wrapper with custom scrollbar * `.table__content` - The `
|
|---|