Button

Actions

A button, or a link styled as one when it has href. loading shows a spinner while the action it started runs: the button keeps focus, is marked busy and ignores clicks.

import { Button } from '@limerdev/zest';
Button for AI tools (llms.txt)
Use for
Actions: submitting a form, opening a dialog, a toolbar command. With href, a navigation that should look like an action.
Don't
A <div> or <span> with onclick. A Button without text: give an icon-only button aria-label. variant="link" for in-text links: use a plain <a>. disabled while an action runs: use loading, which keeps focus on the button.

Examples

Variants

The variants, by the theme's colour roles: primary for the main action, error for deleting, secondary, neutral and outline for the rest, ghost in toolbars, link for a navigation that looks like text.

Sizes

sm, default and lg follow the theme's field size; the icon sizes are square. Give an icon-only button an aria-label.

With an icon

An icon before the text gets a little less padding.

Loading

loading shows a spinner while the action runs: the button keeps focus, is marked busy, and ignores clicks until it is done.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Button

Prop Type Default Description
disabled null | false | true false
href string | null undefined
loading boolean false Waiting for the action it started: a spinner shows (in place of the icon of an icon-size button), it is marked busy and unavailable, and clicks do nothing. Unlike disabled, it keeps keyboard focus.
size "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" 'default' The height and padding, from the theme's field size; the icon sizes are square.
type null | "button" | "submit" | "reset" 'button'
variant "link" | "primary" | "secondary" | "neutral" | "error" | "outline" | "ghost" 'primary' The look, by the theme's colour roles: primary for the main action, error for deleting, secondary, neutral and outline for the rest, ghost in toolbars, link for a navigation that looks like text.