Installation
npx logic2b@next add buttonUsage
import { Button } from "@/components/ui/button"
<Button variant="outline" size="lg">Click me</Button>
Usage notes
As a link
<Button asChild>
<a href="/docs">Read the docs</a>
</Button>Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Button
variant="default"
size="default"
>Continue</Button>API reference
Generated from the public TypeScript exports in src/ui/button.tsx.
Button
ComponentProps: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & { asChild?: boolean }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | null | "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | No | — | — |
size | null | "default" | "sm" | "lg" | "icon" | No | — | — |
asChild | boolean | No | false | — |
buttonVariants
Utility(props?: (ConfigVariants<{ variant: { default: string; destructive: string; outline: string; secondary: string; ghost: string; link: string; }; size: { default: string; sm: string; lg: string; icon: string; }; }> & ClassProp) | undefined): stringAccessibility contract
Machine-readable behavior and consumer responsibilities for button.
- Support
- Native semantics
- Pattern
- button
- HTMLButtonElement
| Keys | Behavior |
|---|---|
| Enter Space | Activate the focused control. |
Built-in semantics
- Uses native button semantics unless asChild changes the rendered element.
Consumer responsibilities
- Keep a visible label or provide aria-label for icon-only actions.