Inputs
Button
Trigger actions with five visual variants, three sizes, leading and trailing icons, and a loading state.
<script>
import { Button } from "@codeatlasdev/ui";
</script>
<Button variant="filled" onclick={save}>Save</Button>
On touch devices every size grows to a 44px target and presses scale down slightly, like a native control.
Variants
filled, glass, outlined, ghost and destructive.
Reference #006 · Pick in the gallery
Code
Sizes
Reference #004 · Pick in the gallery
Code
With icons
Leading and trailing snippets.
Reference #002 · Pick in the gallery
Code
Loading
Swaps the leading icon for a spinner, sets aria-busy and blocks clicks while keeping the label.
Reference #003 · Pick in the gallery
Code
States
Disabled buttons, a destructive action and a link rendered as a button.
Reference #005 · Pick in the gallery
Code
Full width
fullWidth stretches the button to its container.
Reference #001 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'filled' | 'glass' | 'outlined' | 'ghost' | 'destructive' | 'filled' | Visual style. |
size | 'sm' | 'md' | 'lg' | 'md' | Height, padding and font size. |
disabled | boolean | false | Prevents interaction. |
loading | boolean | false | Shows a spinner in place of leading, sets aria-busy, blocks interaction and keeps the label. Adds ca-btn--loading. Screen readers hear "Finished loading" when it ends. |
type | 'button' | 'submit' | 'reset' | string | 'button' | Without href: the HTML button type. With href: the MIME type hint of the linked resource. |
fullWidth | boolean | false | Stretches the button to the width of its container. |
href | string | – | Renders an anchor styled as a button. The props then accept the anchor's attributes: download, rel, hreflang, ping, referrerpolicy. |
target | string | – | Anchor target, used with href. "_blank" adds rel="noopener noreferrer" to any rel you pass. |
children | Snippet | – | Button label. |
leading | Snippet | – | Content before the label. Replaced by a spinner while loading. |
trailing | Snippet | – | Content after the label. |
onclick | (e: MouseEvent) => void | – | Click handler. Not called while disabled or loading. |
aria-label | string | – | Accessible name for icon-only buttons. |
class | string | – | Extra classes on the root element. |