Button
Buttons allow users to trigger actions, submit forms, navigate workflows, and highlight important interactions.
Quick Start
Import and use the Button component with sensible defaults.
1import { Button } from "@ecos/ui"; 2 3<Button>Save Changes</Button>
Variants
Variants provide different levels of visual emphasis.
Default | Outline | Text |
|---|---|---|
1<Button>Save</Button> 2 3<Button variant="outline">Save</Button> 4 5<Button variant="text">Save</Button>
Colours
Colours communicate importance and intent.
Primary | Secondary | Error |
|---|---|---|
1<Button>Save</Button> 2 3<Button color="secondary">Continue</Button> 4 5<Button color="error">Delete</Button>
Sizes
Sizes allow actions to scale appropriately.
Large | Default | Small | Icon |
|---|---|---|---|
1<Button size="large">Large</Button> 2 3<Button>Default</Button> 4 5<Button size="small">Small</Button> 6 7<Button size="icon">✔</Button>
Icons
Buttons support optional icons.
Leading Icon | Icon Only |
|---|---|
1import { Plus } from "lucide-react"; 2 3<Button icon={<Plus />}>Add User</Button> 4 5<Button size="icon" aria-label="Add User"> 6 <Plus /> 7</Button>
Loading State
Use loading states whilst an action is being processed.
Default | Outline | Text |
|---|---|---|
1<Button loading> 2 Saving 3</Button>
Disabled State
Disabled buttons indicate that an action is currently unavailable.
Default | Outline | Text |
|---|---|---|
1<Button disabled> 2 Save 3</Button>
API Reference
Property | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "outline" | "text" | "default" | Defines the button style. |
| color | "primary" | "secondary" | "error" | "primary" | Defines the colour scheme. |
| size | "default" | "small" | "large" | "icon" | "default" | Defines the button size. |
| loading | boolean | false | Displays a spinner and disables interaction. |
| disabled | boolean | false | Prevents user interaction. |
| icon | ReactNode | - | Optional icon displayed before content. |
Visual Reference
Primary
Default | Hover | Active | Focus | Disabled | |
|---|---|---|---|---|---|
| Default | |||||
| Outline | |||||
| Text |
Secondary
Default | Hover | Active | Focus | Disabled | |
|---|---|---|---|---|---|
| Default | |||||
| Outline | |||||
| Text |
Error
Default | Hover | Active | Focus | Disabled | |
|---|---|---|---|---|---|
| Default | |||||
| Outline | |||||
| Text |