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 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

Sparkline & chart colours

A tiny trend chart for KPI cards and table cells, plus a colour palette and themes for Recharts and ECharts.

import { Sparkline, chartColor, rechartsTheme, echartsTheme, readChartTheme } from "kivu-ui"

On this page

UsageChart paletteProps

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 { Sparkline, chartColor, rechartsTheme, echartsTheme, readChartTheme } from "kivu-ui";
import { Sparkline } from "kivu-ui";

const visits = [120, 132, 128, 150, 162, 158, 171, 190, 184, 205, 214, 232];

export default function Demo() {
  return (
    <div className="grid w-full max-w-md gap-6">
      <Sparkline data={visits} label="Visits, last 12 weeks: up from 120 to 232" />
      <Sparkline data={visits} area={false} color="var(--kivu-chart-2)" height={32} />
      <Sparkline variant="bar" data={[4, 7, 5, 9, 6, 11, 8, 12]} color="var(--kivu-chart-3)" />
    </div>
  );
}

Examples

Chart palette

Eight series colours, ordered so neighbours stay distinct for colour-blind readers, in light and dark mode. Use chartColor(i) in Recharts; for ECharts, register echartsTheme(readChartTheme()). Label series with a legend, not by colouring text.

--kivu-chart-1
--kivu-chart-2
--kivu-chart-3
--kivu-chart-4
--kivu-chart-5
--kivu-chart-6
--kivu-chart-7
--kivu-chart-8
import { chartSeries } from "kivu-ui";

export default function Demo() {
  return (
    <div className="grid w-full max-w-md gap-2">
      {chartSeries.map((color, i) => (
        <div key={color} className="flex items-center gap-3 text-sm text-fg-muted">
          <span className="h-3 rounded-full" style={{ background: color, width: `${92 - i * 9}%` }} />
          <code className="shrink-0 font-mono text-xs">--kivu-chart-{i + 1}</code>
        </div>
      ))}
    </div>
  );
}

Props

Sparkline

Extends <div> attributes.

PropTypeDefaultDescription
datanumber[]-Required. Values, oldest first.
variant"line" | "bar""line"Line for trends, bars for counts per period.
heightnumber40Height in px. Width fills the container.
colorstring"var(--kivu-chart-1)"Any CSS colour.
areabooleantrueSoft fill under the line.
highlightLastbooleantrueDot on the latest value, or highlight the latest bar.
domain[min, max]-Fix the vertical scale.
labelstring-Accessible description.

Chart helpers

PropTypeDefaultDescription
chartColor(i)string-var(--kivu-chart-N) for series i (0-based). Works in SVG charts and follows dark mode.
rechartsThemeobject-Props to spread: grid, xAxis, yAxis, tooltip, legend, line, area, bar.
readChartTheme(el?)ResolvedChartTheme-Resolves the tokens to hex values for canvas charts. Re-run on theme change.
echartsTheme(theme)object-ECharts theme from a mode or a resolved theme.
chartColors{ light, dark }-The palette as hex values.

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

PreviousPaginationNextBanner