Button Demo
A demo example showing the ai2 Button component in four states: a brand CTA with a trailing arrow icon, an outline variant, a soft danger variant for destructive actions, and a brand button in the loading state. It is installed with npx shadcn@latest add @ai2/button-demo, which also pulls in the @ai2/button dependency.


Installed with shadcn add · 2 workarounds · theme from registry.json
- applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
- installed base item https://ai2.design/r/tokens.json (registry preview settings)
Installation
Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { ArrowRight } from "lucide-react"import { Button } from "@/registry/ai2/ui/button"export function Example() { return ( <Button tone="brand"> Get started <ArrowRight /> </Button> )}- Looking for a copy-paste reference for the ai2 Button's tone, variant, and isLoading props together
- Need a primary CTA with a trailing icon, such as a Get started or Next action
- Want to see how to pair an outline secondary action with a brand primary action
- Building a destructive action row and need a soft danger button example
Examples
Full demo layout
The complete registry example: four buttons in a wrapping flex row showing brand, outline, soft danger, and loading states.
import { ArrowRight } from "lucide-react"import { Button } from "@/registry/ai2/ui/button"export default function ButtonDemo() { return ( <div className="flex flex-wrap items-center gap-3"> <Button tone="brand"> Get started <ArrowRight /> </Button> <Button variant="outline">View docs</Button> <Button variant="soft" tone="danger"> Delete </Button> <Button tone="brand" isLoading> Deploying </Button> </div> )}Loading submit button
A brand button that shows the isLoading state while a form is submitting.
import { Button } from "@/registry/ai2/ui/button"export function SubmitButton({ pending }: { pending: boolean }) { return ( <Button tone="brand" isLoading={pending}> Save changes </Button> )}Destructive action
A soft danger button for an irreversible action.
import { Button } from "@/registry/ai2/ui/button"export function DeleteButton() { return ( <Button variant="soft" tone="danger"> Delete </Button> )}API reference
Accessibility
- Button renders a native button element, so it is focusable and activates on Enter and Space by default (assuming @ai2/button forwards to a native button, which is not shown in this item).
- Icon-only use is not shown in the demo. When one is added, supply an aria-label because ArrowRight has no text.
- The isLoading state should expose progress to assistive tech, for example through aria-busy or a visually hidden status. Verify this in the @ai2/button source.
- Do not rely on tone color alone to convey danger. Pair the Delete button with clear label text, as the demo does.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Button Demo" component (ai2/button-demo) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/button-demo2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: tone, variant, isLoading.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { ArrowRight } from "lucide-react"import { Button } from "@/registry/ai2/ui/button"export function Example() { return ( <Button tone="brand"> Get started <ArrowRight /> </Button> )}```Files & dependencies
- registry/ai2/examples/button-demo.tsx