# Lode UI: full reference > Every component, block and template doc in one file. Pro source is never included. --- # Button > A clear, responsive action with quiet secondary states. Component · Free · https://lodeui.com/components/button ## When to use - The main or secondary action in a form, dialog, card or toolbar. - Async actions that need a loading state without the button changing width. - Icon-only actions in dense toolbars, with an aria-label. ## When not to use - Navigating to another page: render a link styled with buttonVariants() instead. - Picking one option from a few: use a segmented control or radio group. - An action whose result should show in place (Saved, Failed): use the action button. ## Installation ```bash npx shadcn@latest add https://lodeui.com/r/button.json ``` ## Usage ```tsx title="example.tsx" import { Button } from "@/components/ui/button"; export function SaveBar({ pending, onSave }: { pending: boolean; onSave: () => void }) { return (
); } ``` ## API reference ### Button A native button with five visual weights, five sizes and a loading state. All other button attributes pass through. | Prop | Type | Default | Description | | --- | --- | --- | --- | | variant | `"primary" \| "secondary" \| "outline" \| "ghost" \| "destructive"` | `"primary"` | Visual weight. Use one primary per view. | | size | `"sm" \| "md" \| "lg" \| "icon" \| "icon-sm"` | `"md"` | Height and padding. Icon sizes are square. | | loading | `boolean` | `false` | Shows a spinner, disables the button and keeps its width so the layout doesn't jump. | | type | `"button" \| "submit" \| "reset"` | `"button"` | Defaults to button so it never submits a form by accident. | | ...props | `ButtonHTMLAttributes` | – | onClick, disabled, aria-* and anything else a button accepts. | ### buttonVariants Returns the button class string, for links and other elements that should look like a button. | Prop | Type | Default | Description | | --- | --- | --- | --- | | options | `{ variant?; size?; className? }` | – | Same variant and size values as Button. | ## Keyboard interactions | Keys | Action | | --- | --- | | Enter / Space | Activates the button | | Tab | Moves focus to and from the button | ## Accessibility - Renders a real