v0.1.0
Get startedComponentsTheming
Install

Getting started

  • Introduction
  • Installation
  • Tailwind CSS
  • Next.js

Theming

  • Design tokens
  • Dark mode
  • Customization

Layout

  • SectionHeader
  • Container & Divider
  • AppShell
  • PageHeader

Actions

  • Button
  • IconButton

Forms

  • Input
  • Textarea
  • Select
  • Checkbox
  • Switch
  • SegmentedControl
  • RadioGroup
  • Combobox
  • DatePicker & DateRangePicker

Disclosure

  • Tabs
  • Accordion

Overlay

  • Modal
  • Drawer
  • Tooltip
  • Popover
  • DropdownMenu

Data display

  • Badge
  • Avatar
  • Card
  • StatCard
  • Table & DataTable
  • Pagination
  • Sparkline & chart colours

Feedback

  • Banner
  • Spinner
  • Skeleton
  • EmptyState
  • Toast
  • Progress

A lightweight, Tailwind-friendly React component library.

Getting started

  • Introduction
  • Installation
  • Tailwind CSS
  • Next.js

Theming

  • Design tokens
  • Dark mode
  • Customization

Components

  • SectionHeader
  • Container & Divider
  • AppShell
  • PageHeader
  • Button
  • IconButton
  • Input

Released under the MIT License.@kivu-ui/react on npm

Documentation

Getting started

  • Introduction
  • Installation
  • Tailwind CSS
  • Next.js

Theming

  • Design tokens
  • Dark mode
  • Customization

Layout

  • SectionHeader
  • Container & Divider
  • AppShell
  • PageHeader

Actions

  • Button
  • IconButton

Forms

  • Input
  • Textarea
  • Select
  • Checkbox
  • Switch
  • SegmentedControl
  • RadioGroup
  • Combobox
  • DatePicker & DateRangePicker

Disclosure

  • Tabs
  • Accordion

Overlay

  • Modal
  • Drawer
  • Tooltip
  • Popover
  • DropdownMenu

Data display

  • Badge
  • Avatar
  • Card
  • StatCard
  • Table & DataTable
  • Pagination
  • Sparkline & chart colours

Feedback

  • Banner
  • Spinner
  • Skeleton
  • EmptyState
  • Toast
  • Progress

Table & DataTable

Styled table parts for full control, and DataTable for sorting, row selection, loading and empty states.

import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, DataTable } from "@kivu-ui/react"

On this page

UsageDataTableLoading & emptyProps

Getting started

  • Introduction
  • Installation
  • Tailwind CSS
  • Next.js

Theming

  • Design tokens
  • Dark mode
  • Customization

Layout

  • SectionHeader
  • Container & Divider
  • AppShell
  • PageHeader

Actions

  • Button
  • IconButton

Forms

  • Input
  • Textarea
  • Select
  • Checkbox
  • Switch
  • SegmentedControl
  • RadioGroup
  • Combobox
  • DatePicker & DateRangePicker

Disclosure

  • Tabs
  • Accordion

Overlay

  • Modal
  • Drawer
  • Tooltip
  • Popover
  • DropdownMenu

Data display

  • Badge
  • Avatar
  • Card
  • StatCard
  • Table & DataTable
  • Pagination
  • Sparkline & chart colours

Feedback

  • Banner
  • Spinner
  • Skeleton
  • EmptyState
  • Toast
  • Progress

Usage

import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, DataTable } from "@kivu-ui/react";
InvoiceCustomerStatusAmount
#1042Nyota CoffeePaid$1,240.00
#1041Ikaze StudioOverdue$860.50
#1040Kivu LogisticsPaid$12,400.00
import { Badge, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@kivu-ui/react";

const invoices = [
  { id: "#1042", customer: "Nyota Coffee", status: "Paid", amount: "$1,240.00" },
  { id: "#1041", customer: "Ikaze Studio", status: "Overdue", amount: "$860.50" },
  { id: "#1040", customer: "Kivu Logistics", status: "Paid", amount: "$12,400.00" },
];

export default function Demo() {
  return (
    <Table className="w-full" density="compact">
      <TableHeader>
        <TableRow>
          <TableHead>Invoice</TableHead>
          <TableHead>Customer</TableHead>
          <TableHead>Status</TableHead>
          <TableHead align="end">Amount</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        {invoices.map((inv) => (
          <TableRow key={inv.id}>
            <TableCell>{inv.id}</TableCell>
            <TableCell>{inv.customer}</TableCell>
            <TableCell>
              <Badge size="sm" tone={inv.status === "Paid" ? "success" : "danger"}>{inv.status}</Badge>
            </TableCell>
            <TableCell numeric>{inv.amount}</TableCell>
          </TableRow>
        ))}
      </TableBody>
    </Table>
  );
}

Examples

DataTable

Describe the columns; sorting and selection are handled for you. Click a header to sort.

Status
JBJean BoscoEngineerActive168.0
AUAmara UwaseDesignerActive142.5
EMEric MugishaEngineerActive121.3
GIGrace InezaProductInvited0.0

selected: []

import { useState } from "react";
import { Avatar, Badge, DataTable, type DataTableColumn } from "@kivu-ui/react";

interface Member { id: string; name: string; role: string; status: "Active" | "Invited"; hours: number }

const members: Member[] = [
  { id: "1", name: "Amara Uwase", role: "Designer", status: "Active", hours: 142.5 },
  { id: "2", name: "Jean Bosco", role: "Engineer", status: "Active", hours: 168 },
  { id: "3", name: "Grace Ineza", role: "Product", status: "Invited", hours: 0 },
  { id: "4", name: "Eric Mugisha", role: "Engineer", status: "Active", hours: 121.25 },
];

const columns: DataTableColumn<Member>[] = [
  {
    id: "name", header: "Name", accessor: "name", sortable: true,
    cell: (m) => <span className="flex items-center gap-2"><Avatar name={m.name} size="sm" />{m.name}</span>,
  },
  { id: "role", header: "Role", accessor: "role", sortable: true },
  { id: "status", header: "Status", accessor: "status", cell: (m) => <Badge size="sm" tone={m.status === "Active" ? "success" : "neutral"}>{m.status}</Badge> },
  { id: "hours", header: "Hours", accessor: "hours", numeric: true, sortable: true, cell: (m) => m.hours.toFixed(1) },
];

export default function Demo() {
  const [selected, setSelected] = useState<string[]>([]);
  return (
    <div className="w-full">
      <DataTable
        aria-label="Team members"
        columns={columns}
        data={members}
        selectable
        selectedIds={selected}
        onSelectedIdsChange={setSelected}
        defaultSort={{ id: "hours", direction: "desc" }}
      />
      <p className="mt-3 font-mono text-xs text-fg-muted">selected: [{selected.join(", ")}]</p>
    </div>
  );
}

Loading & empty

CustomerTotal
import { DataTable, SegmentedControl, type DataTableColumn } from "@kivu-ui/react";
import { useState } from "react";

const columns: DataTableColumn<{ id: string; name: string; total: number }>[] = [
  { id: "name", header: "Customer", accessor: "name" },
  { id: "total", header: "Total", accessor: "total", numeric: true },
];

export default function Demo() {
  const [state, setState] = useState("loading");
  return (
    <div className="grid w-full gap-4">
      <SegmentedControl aria-label="Table state" size="sm" options={["loading", "empty"]} value={state} onValueChange={setState} />
      <DataTable
        aria-label="Customers"
        columns={columns}
        data={[]}
        loading={state === "loading"}
        loadingRows={3}
        empty="No customers match these filters"
      />
    </div>
  );
}

Props

Table

Extends <table> attributes.

PropTypeDefaultDescription
density"compact" | "default" | "comfortable""default"Row height.
stickyHeaderbooleanfalseKeep the header visible while scrolling. Set maxHeight too.
maxHeightCSS length-Scroll vertically past this height.
stripedbooleanfalseAlternate row backgrounds.
hoverbooleantrueHighlight the row under the pointer.
barebooleanfalseNo outer border or radius, e.g. inside a Card.
wrapperClassNamestring-Class for the scrolling wrapper.

TableHead

PropTypeDefaultDescription
align"start" | "center" | "end""start"Text alignment.
sort"asc" | "desc" | false-Current sort. false means sortable but not sorted.
onSort() => void-Makes the header a sort button.

TableCell

PropTypeDefaultDescription
numericbooleanfalseRight-aligned, same-width digits.
align"start" | "center" | "end"-Text alignment.

DataTable

Also takes the Table props.

PropTypeDefaultDescription
columnsDataTableColumn<T>[]-Required. id, header, accessor, cell, sortable, numeric, width…
dataT[]-Required. The rows.
getRowId(row, index) => stringrow.idStable id for selection.
selectablebooleanfalseAdd a checkbox column with select-all.
selectedIds / onSelectedIdsChangestring[] / (ids) => void-Control the selection.
sort / defaultSort / onSortChange{ id, direction } | null-Control the sort.
manualSortbooleanfalseDon't sort in the browser; sort on the server from onSortChange.
loadingbooleanfalseShow skeleton rows (or dim existing rows).
emptyReactNode-Shown with no rows. A string becomes an EmptyState title.
onRowClick(row: T) => void-Make rows clickable.

Every component also accepts className and forwards its ref. Root CSS class: .kivu-table

PreviousStatCardNextPagination