Component
Button
Triggers an action. Four variants (including a bouncy kawaii one), loading states with a spinner or mascot, icons and polymorphic rendering.
Playground
import { ChibiButton } from '@chibi-ui/react/button';
<ChibiButton variant="kawaii" leftIcon={<HeartIcon />}>
Adopt Mochi
</ChibiButton>Import
import {
ChibiButton,
buttonVariants,
} from '@chibi-ui/react/button';Examples
import Link from 'next/link';
import { ChibiButton } from '@chibi-ui/react/button';
<ChibiButton asChild variant="secondary" rightIcon={<ArrowRightIcon />}>
<Link href="/docs">Read the docs</Link>
</ChibiButton>const [saving, setSaving] = useState(false);
<ChibiButton
loading={saving}
loadingText="Saving…"
onClick={async () => {
setSaving(true);
await save();
setSaving(false);
}}
>
Save
</ChibiButton>Accessibility
- Renders a native <button type="button"> by default, so it never submits a form by accident.
- While loading the button keeps focus: it uses aria-disabled + aria-busy instead of the native disabled attribute.
- Icons are wrapped in aria-hidden spans. Icon-only buttons must have an aria-label (a development warning reminds you).
- The focus ring is an outline, so it stays visible in Windows forced-colours mode.
- Press and hover motion is removed under prefers-reduced-motion.
API reference
ChibiButton
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'primary' | 'secondary' | 'ghost' | 'kawaii' | 'primary' | Visual style. |
| size | 'sm' | 'md' | 'lg' | 'icon' | 'md' | Height and padding. |
| fullWidth | boolean | false | Stretch to the container width. |
| loading | boolean | false | Shows a spinner and blocks activation while keeping focus. |
| loadingText | string | — | Label shown while loading. |
| spinner | 'ring' | 'mascot' | 'ring' | Spinner style while loading. |
| leftIcon / rightIcon | ReactNode | — | Decorative icons. |
| asChild | boolean | false | Merge props into the single child (e.g. <a> or <Link>). |
| … | ComponentProps<'button'> | — | All native button props, plus ref. |