SpecOS SpecOS icon Styleguide

Button

A versatile button component that supports multiple variants, states, and icon integration. Features smooth transitions, status indicators, and full keyboard navigation support. Each button demonstrates a different variant and will show success/error states when clicked.

Import

import Button from "$lib/components/Button.svelte";

Primary

The main call-to-action button style.

Secondary

A less prominent alternative to the primary button.

Outline

A bordered button that maintains visual hierarchy.

Ghost

A minimal button that becomes more prominent on hover.

Positive

Used for success or confirmation actions.

Destructive

Used for destructive or dangerous actions.

Properties

label
Type
string
Default: ""
The text content of the button.
icon
Type
string
Default: ""
Name of the icon to display (from your icons directory). Status icons will only show if an icon is provided.
iconPosition
Type
"left" | "right"
Default: "right"
Position of the icon relative to the label.
disabled
Type
boolean
Default: false
Whether the button is disabled.
onclick
Type
() => void | Promise<void>
Default: () => {}
Function to call when the button is clicked.
variant
Type
"primary" | "secondary" | "outline" | "ghost" | "positive" | "destructive"
Default: "primary"
The visual style variant of the button.
size
Type
"sm" | "md" | "lg" | "icon"
Default: "md"
The size variant of the button.
fullWidth
Type
boolean
Default: false
Whether the button should take up the full width of its container.
showStatus
Type
boolean
Default: true
Whether the button should show success/error states after clicking. Only shows status icons if an icon is provided.
status
Type
"idle" | "success" | "error" | "warning"
Default: "idle"
The current status of the button. Automatically managed when showStatus is true.
className
Type
string
Default: ""
Additional CSS classes to apply to the button.