Skip to content

Displays a button or an element that looks like a button.

[atlasButton]

Examples

Variants

Seven variants map to the intent of the action. primary is the default.

Sizes

sm for toolbars, default for forms, lg for calls to action, and icon for square icon- only buttons (give them an aria-label ).

Icons and states

Put an atlas-icon before the label; a disabled button is dimmed and ignores pointer events. loading marks a busy button ( aria-busy ) and ignores clicks, but keeps keyboard focus, unlike disabled .

API

Generated from the library source, so it always matches the code.

AtlasButtonDirective [atlasButton]

InputTypeDefaultDescription
variant ButtonVariants['variant']'primary' Visual style: primary (the main action), default (neutral), secondary , outline , ghost (toolbar and icon buttons), destructive (deleting, irreversible) or link .
size ButtonVariants['size']'default' Height and padding: sm , default , lg , or icon (square, for an icon-only button with an aria-label ).
loading unknownfalse Busy state: aria-busy + aria-disabled , dimmed, clicks ignored. Unlike disabled , the button keeps keyboard focus while the work runs.
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.

Types

ButtonVariants

type ButtonVariants = VariantProps<typeof buttonVariants>