Skip to content
ChibiUI

Component

Button

Triggers an action. Four variants (including a bouncy kawaii one), loading states with a spinner or mascot, icons and polymorphic rendering.

Playground

Generated code
import { ChibiButton } from '@chibi-ui/react/button';

<ChibiButton variant="kawaii" leftIcon={<HeartIcon />}>
  Adopt Mochi
</ChibiButton>

Import

TSX
import {
  ChibiButton,
  buttonVariants,
} from '@chibi-ui/react/button';

Examples

Router links with asChild
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>
Async action
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

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'ghost' | 'kawaii''primary'Visual style.
size'sm' | 'md' | 'lg' | 'icon''md'Height and padding.
fullWidthbooleanfalseStretch to the container width.
loadingbooleanfalseShows a spinner and blocks activation while keeping focus.
loadingTextstring—Label shown while loading.
spinner'ring' | 'mascot''ring'Spinner style while loading.
leftIcon / rightIconReactNode—Decorative icons.
asChildbooleanfalseMerge props into the single child (e.g. <a> or <Link>).
…ComponentProps<'button'>—All native button props, plus ref.