Skip to content
ChibiUI

Guide

Theming & tokens

Every colour, radius, shadow and easing curve is a CSS variable generated from one TypeScript source. That source is also exported, so you can use the tokens in charts or emails.

Light, dark & scoped themes

Set data-chibi-theme to light, dark or system on any element. Themes are scoped, so a dark card can sit on a light page.

TSX
<html data-chibi-theme="system">
  โ€ฆ
  <section data-chibi-theme="dark">Always dark in here</section>
</html>

Customising

Override semantic tokens anywhere in your CSS:

globals.css
:root {
  --chibi-primary: #fcc9d8;      /* pink buttons */
  --chibi-primary-hover: #f6a8c0;
  --chibi-radius-lg: 2rem;       /* extra round */
}

Run the contrast check against your overrides with the exported helper, for example in a unit test:

TSX
import { AA, contrastRatio } from '@chibi-ui/react/tokens';

expect(contrastRatio('#121715', '#fcc9d8')).toBeGreaterThanOrEqual(AA.text);

Contrast report

This page computes the report at build time from @chibi-ui/react/tokens, which is a plain, server-safe module. The same pairs are enforced in CI.

Light theme
UsageSampleRatioRequirement
Body textAa15.63:1โœ… 4.5:1 (text)
Muted textAa6.28:1โœ… 4.5:1 (text)
Primary buttonAa11.28:1โœ… 4.5:1 (text)
Secondary buttonAa12.41:1โœ… 4.5:1 (text)
Kawaii buttonAa12.41:1โœ… 4.5:1 (text)
Success toastAa8.60:1โœ… 4.5:1 (text)
Warning toastAa8.86:1โœ… 4.5:1 (text)
Error toastAa6.52:1โœ… 4.5:1 (text)
Info toastAa9.01:1โœ… 4.5:1 (text)
Input border3.76:1โœ… 3:1 (UI)
Focus ring15.63:1โœ… 3:1 (UI)
Brand icons4.31:1โœ… 3:1 (UI)
Highlighted textAa10.08:1โœ… 4.5:1 (text)
Dark theme
UsageSampleRatioRequirement
Body textAa17.40:1โœ… 4.5:1 (text)
Muted textAa10.12:1โœ… 4.5:1 (text)
Primary buttonAa11.28:1โœ… 4.5:1 (text)
Secondary buttonAa9.66:1โœ… 4.5:1 (text)
Kawaii buttonAa9.66:1โœ… 4.5:1 (text)
Success toastAa12.03:1โœ… 4.5:1 (text)
Warning toastAa12.97:1โœ… 4.5:1 (text)
Error toastAa10.24:1โœ… 4.5:1 (text)
Info toastAa12.23:1โœ… 4.5:1 (text)
Input border4.30:1โœ… 3:1 (UI)
Focus ring11.28:1โœ… 3:1 (UI)
Brand icons11.28:1โœ… 3:1 (UI)
Highlighted textAa9.54:1โœ… 4.5:1 (text)

Palette

pink

  • 50#fff5f8
  • 100#ffe4ec
  • 200#fcc9d8
  • 300#f6a8c0
  • 400#ec84a5
  • 500#d95f87
  • 600#b8436b
  • 700#933353
  • 800#6c263e
  • 900#47192a

blue

  • 50#f3f8fd
  • 100#e0eefa
  • 200#c5dcf2
  • 300#a3c5e8
  • 400#7ea9d8
  • 500#5b8bc4
  • 600#446fa6
  • 700#355685
  • 800#273f62
  • 900#1a2a42

yellow

  • 50#fffbeb
  • 100#fff4c7
  • 200#ffe99a
  • 300#fbdb73
  • 400#f2c84b
  • 500#d9a82a
  • 600#a87d14
  • 700#7d5c10
  • 800#574011
  • 900#36280c

mint

  • 50#f0fbf6
  • 100#d9f5e8
  • 200#b7ebd3
  • 300#8ddcb9
  • 400#63c79c
  • 500#3fa97e
  • 600#2d8664
  • 700#23674e
  • 800#1b4b3a
  • 900#123227

lavender

  • 50#f8f5ff
  • 100#ede6ff
  • 200#dccffd
  • 300#c6b3f7
  • 400#a990ec
  • 500#8b6fdc
  • 600#6f53bf
  • 700#563f97
  • 800#3e2e6c
  • 900#281e46

coral

  • 50#fff4f2
  • 100#ffe2dc
  • 200#ffc6ba
  • 300#fca592
  • 400#f2806a
  • 500#dc5a43
  • 600#b8402c
  • 700#8f3123
  • 800#66241a
  • 900#421811

ink

  • 50#f8fbfa
  • 100#eef3f2
  • 200#dce5e3
  • 300#c3cfcc
  • 400#9aa9a5
  • 500#778783
  • 600#56635f
  • 700#3e4946
  • 800#2a3331
  • 900#1b2220
  • 950#121715

Raw palette steps are exposed as --chibi-{name}-{step}. Components only use the semantic tokens, for example --chibi-bg, --chibi-surface, --chibi-surface-muted, --chibi-fgโ€ฆ