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.
<html data-chibi-theme="system">
โฆ
<section data-chibi-theme="dark">Always dark in here</section>
</html>Customising
Override semantic tokens anywhere in your 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:
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.
| Usage | Sample | Ratio | Requirement |
|---|---|---|---|
| Body text | Aa | 15.63:1 | โ 4.5:1 (text) |
| Muted text | Aa | 6.28:1 | โ 4.5:1 (text) |
| Primary button | Aa | 11.28:1 | โ 4.5:1 (text) |
| Secondary button | Aa | 12.41:1 | โ 4.5:1 (text) |
| Kawaii button | Aa | 12.41:1 | โ 4.5:1 (text) |
| Success toast | Aa | 8.60:1 | โ 4.5:1 (text) |
| Warning toast | Aa | 8.86:1 | โ 4.5:1 (text) |
| Error toast | Aa | 6.52:1 | โ 4.5:1 (text) |
| Info toast | Aa | 9.01:1 | โ 4.5:1 (text) |
| Input border | 3.76:1 | โ 3:1 (UI) | |
| Focus ring | 15.63:1 | โ 3:1 (UI) | |
| Brand icons | 4.31:1 | โ 3:1 (UI) | |
| Highlighted text | Aa | 10.08:1 | โ 4.5:1 (text) |
| Usage | Sample | Ratio | Requirement |
|---|---|---|---|
| Body text | Aa | 17.40:1 | โ 4.5:1 (text) |
| Muted text | Aa | 10.12:1 | โ 4.5:1 (text) |
| Primary button | Aa | 11.28:1 | โ 4.5:1 (text) |
| Secondary button | Aa | 9.66:1 | โ 4.5:1 (text) |
| Kawaii button | Aa | 9.66:1 | โ 4.5:1 (text) |
| Success toast | Aa | 12.03:1 | โ 4.5:1 (text) |
| Warning toast | Aa | 12.97:1 | โ 4.5:1 (text) |
| Error toast | Aa | 10.24:1 | โ 4.5:1 (text) |
| Info toast | Aa | 12.23:1 | โ 4.5:1 (text) |
| Input border | 4.30:1 | โ 3:1 (UI) | |
| Focus ring | 11.28:1 | โ 3:1 (UI) | |
| Brand icons | 11.28:1 | โ 3:1 (UI) | |
| Highlighted text | Aa | 9.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โฆ