Skip to content
English
Bite button comes with Pro. Its preview shows once you unlock it.

How it works

Each press spends a use. The outline is drawn as one smooth path, and every use takes a round bite out of it with two or three soft scallops. The bars beside the label and the quota line show what is left. When the last bite has crumbled the button away, the empty message and the optional next action take its place. Crumbs settle 12px under the button by default (the --ds-bite-floor variable), so leave that much room below it.

Use it for

  • Show a small daily or trial allowance next to the action that spends it.
  • Use a single bite for a one-use action, such as claiming a coupon.

Usage

import { BiteButton } from './BiteButton.jsx'

export function GenerationAction({ remaining, generate, openPlans }) {
  return (
    <BiteButton
      bites={4}
      remaining={remaining}
      labels={{ button: 'Generate', empty: 'See plans', emptyMessage: 'No free generations left today' }}
      onBite={generate}
      onEmptyAction={openPlans}
    />
  )
}

Props

PropTypeDefaultWhat it does
bitesnumber4Total quota, from 1 to 8. In uncontrolled use, changing the total preserves the number of uses already spent.
remainingnumber—Controlled quota from 0 to bites. Update it to commit a bite or refill, or omit it to let the button manage the count.
defaultRemainingnumberbitesStarting count when the button manages the quota.
onBite(remaining: number) => void—Called once per activation with the requested count after one use.
onEmpty() => void—Called when the quota changes from positive to zero.
onRefill(remaining: number) => void—Receives the full count when a timed refill is due. In controlled use, apply the new count in the parent.
onEmptyAction() => void—Provide the handler for the empty action, such as opening the plan picker. The action is shown when this handler is supplied.
renderEmptyAction(buttonProps: BiteEmptyActionProps) => ReactNode—Optional renderer for the quiet action. Forward ref, type, title, onClick, onKeyDown and children to a native button, and use size to match the active control.
refill'manual' | number'manual'Use manual mode with an externally controlled reset, or set a delay in milliseconds after the empty state appears.
size'sm' | 'md' | 'lg''md'Visual height of 28, 36 or 44 pixels. The hit area is at least 44 pixels tall.
variant'ink' | 'accent' | 'outline''ink'Ink, accent fill or an outline that traces every bite. Crumbs take the same colour.
pipsbooleantrueShows one short bar per use beside the label; each bite eats the last one still standing.
labels{ button?: string, empty?: string, emptyMessage?: string, quota?: (remaining: number, total: number) => string, name?: (label: string, remaining: number, total: number) => string, remaining?: (remaining: number, total: number) => string, depleted?: string, refilled?: (remaining: number, total: number) => string }—Overrides the visible labels, the action's accessible name and the live announcements.

Accessibility

  • Tab focuses the native button. Enter and Space spend one use per press, including when a key is held.
  • The accessible name includes the available count, and a polite region announces changes. The bars, the bites and the crumbs are hidden from assistive technology.
  • When the focused button disappears, focus moves to the next action or to the empty message. The hit area stays a full rectangle, at least 44px tall, however much is eaten.

Motion

A bite closes in about 110ms while the button tugs towards it and springs back, and one bar swells and is eaten. Four to six crumbs hop out of the bite with a spin, bounce once, settle in a small heap under it and fade after about three seconds. The last bite clears the heap; what is left of the button collapses towards its middle and crumbles, and the empty state rises in. With reduced motion nothing travels: bites and bars change at once and the last step is a short fade.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

BiteButton.jsxbite-button.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Buttons
Aurora rim button comes with Pro. Its preview shows once you unlock it.