Actions
Button
Pill-shaped button for actions and links. Use one primary button per screen for the main action; everything else is dark, outline or ghost.
import { Button } from '@statix/ui/button';Playground
<Button>Choose plan</Button>Examples
Variants
primary is the deep-blue accent and marks the one main action. dark carries strong secondary actions such as calling support. outline and ghost are for everything else.
<script lang="ts">
import { Button } from '@statix/ui/button';
</script>
<Button>Choose plan</Button>
<Button variant="dark">Check website</Button>
<Button variant="outline">Book a call</Button>
<Button variant="secondary">Download invoice</Button>
<Button variant="ghost">Cancel</Button>
<Button variant="destructive">Delete mailbox</Button>
<Button variant="link">View all backups</Button>Sizes
sm (36px), md (44px, default) and lg (52px).
<script lang="ts">
import { Button } from '@statix/ui/button';
</script>
<Button size="sm">Choose plan</Button>
<Button size="md">Choose plan</Button>
<Button size="lg">Choose plan</Button>With an icon
Put a Lucide icon before or after the label and mark it with data-icon="inline-start" or "inline-end" so the padding balances.
<script lang="ts">
import { Button } from '@statix/ui/button';
import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
import PhoneIcon from '@lucide/svelte/icons/phone';
import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';
</script>
<Button variant="dark">
<PhoneIcon data-icon="inline-start" />
040 468 970 790
</Button>
<Button variant="outline">
Details
<ArrowRightIcon data-icon="inline-end" />
</Button>
<Button>
<RotateCcwIcon data-icon="inline-start" />
Restore website
</Button>Icon only
Square sizes for toolbars. Always give them an aria-label.
<script lang="ts">
import { Button } from '@statix/ui/button';
import BellIcon from '@lucide/svelte/icons/bell';
import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
import SearchIcon from '@lucide/svelte/icons/search';
</script>
<Button variant="outline" size="icon-sm" aria-label="Search">
<SearchIcon />
</Button>
<Button variant="secondary" size="icon" aria-label="Notifications">
<BellIcon />
</Button>
<Button variant="ghost" size="icon-lg" aria-label="More actions">
<EllipsisIcon />
</Button>On dark surfaces
light and on-tone sit on navy cards and other tone fills.
<script lang="ts">
import { Button } from '@statix/ui/button';
import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
</script>
<Button variant="light">
Go to your websites
<ArrowRightIcon data-icon="inline-end" />
</Button>
<Button variant="on-tone">Compare plans</Button>As a link
Pass href and the button renders an <a>. Use it for navigation, not for actions.
<script lang="ts">
import { Button } from '@statix/ui/button';
</script>
<Button href="#pricing">See pricing</Button>
<Button href="#invoices" variant="outline">Open invoices</Button>Disabled
Prefer explaining why an action is unavailable over disabling it. When you must, the button fades to 50%.
<script lang="ts">
import { Button } from '@statix/ui/button';
</script>
<Button disabled>Restore website</Button>
<Button variant="outline" disabled>Book a call</Button>Guidelines
Do
- Start labels with a verb and say what happens: "Restore website", "Choose plan".
- Use one primary button per view. Pair it with an outline or ghost button for the alternative.
- Use the link variant for inline actions inside text.
Don't
- Don’t put two primary buttons next to each other.
- Don’t use a button where a plain link reads better, for example in body copy.
- Don’t shorten labels to "OK" or "Submit".
Accessibility
- Renders a native <button type="button"> (or <a> with href), so Enter and Space work without extra code.
- Icon-only buttons need an aria-label. The icon itself is decorative.
- A disabled link gets aria-disabled, role="link" and is removed from the tab order.
- The focus ring uses --ring at 40% opacity, 3px wide, visible on all variants.
API reference
Button
renders<button> or <a> and accepts its attributes| Prop | Type | Default |
|---|---|---|
variant | 'primary' | 'dark' | 'light' | 'outline' | 'secondary' | 'ghost' | 'on-tone' | 'destructive' | 'link' Visual style. default is accepted as an alias of primary for shadcn compatibility. | 'primary' |
size | 'sm' | 'md' | 'lg' | 'icon-sm' | 'icon' | 'icon-lg' Height and padding. default is an alias of md. | 'md' |
href | string Renders an <a> instead of a <button>. | – |
disabled | boolean Disables the button or link. | false |
ref bind | HTMLButtonElement | HTMLAnchorElement | null The rendered element. | – |
class | ClassValue Merged with the variant classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="button" | Always present. Target it from a parent with in-data-[slot=…]. |
data-variant | The current variant. |
buttonVariants
The tailwind-variants function behind Button. Call it to style other elements like a button, or extend it for app-specific variants.