import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import { For, createSignal, onMount } from 'solid-js'; const meta = { title: 'Theming/Typography', parameters: { layout: 'padded' }, } satisfies Meta; export default meta; type Story = StoryObj; // The semantic type scale (defined in theme.css `@theme`). Each row is a token // that generates a Tailwind utility AND is an overridable CSS custom property. const SCALE = [ { token: '--text-caption', cls: 'text-caption', role: 'Micro labels, badges, sub-counts', used: 'token sub-totals · model provider · media-type subtitle' }, { token: '--text-meta', cls: 'text-meta', role: 'Controls, toggles, switchers, captions', used: 'reasoning / chain-of-thought triggers · model switcher · context · source' }, { token: '--text-body', cls: 'text-body', role: 'Primary reading text', used: 'messages · input · suggestions · markdown (also scales with the `proseSize` prop)' }, { token: '--text-title', cls: 'text-title', role: 'Emphasis / headers', used: 'section emphasis' }, ] as const; function TypographyScale() { const [px, setPx] = createSignal>({}); onMount(() => { const cs = getComputedStyle(document.documentElement); const toPx = (rem: string) => { const v = parseFloat(rem); return rem.includes('rem') ? `${Math.round(v * 16)}px` : rem.trim(); }; setPx(Object.fromEntries(SCALE.map((s) => [s.token, toPx(cs.getPropertyValue(s.token))]))); }); return (

Typography scale

Defined once in theme.css. Each token generates a Tailwind utility (text-meta, …). To restyle the kit's typography globally, override the namespaced --kc-text-* token on :root — it pierces the Shadow DOM exactly like the --kc-color-* tokens. (The bare --text-* names stay internal, so a host's own tokens can't collide.)

{(s) => (
{s.token}
{px()[s.token] ?? '…'}
{s.role}
The quick brown fox jumps over the lazy dog
{s.used}
)}

Override example

{`:root {
  --kc-text-body: 0.9375rem;   /* bump the reading size to 15px */
  --kc-text-meta: 0.8125rem;   /* and the control size to 13px */
}`}

Reading text in messages / input / markdown additionally scales with the proseSize prop (xs · sm · base · lg); these tokens cover the fixed chrome & controls.

); } /** The kit's semantic type scale — defined in theme.css, used everywhere, overridable. */ export const Typography: Story = { render: () => , };