Docs / Components
SenseButtonComponent
Primary action control from @artificialsenselabs/ui — composes sense-icon, sense-spinner, and sense-badge internally.
Live demo: run nx serve showcase and open /components/button (port 4202).
Overview
Category: Form / actions. Selector: sense-button. Import: import { SenseButtonComponent } from '@artificialsenselabs/ui';
<sense-button severity="primary" icon="search" [loading]="saving()" (clicked)="save()">
Save
</sense-button>API
Generated from libs/ui/src/lib/button/sense-button/sense-button.component.ts — run pnpm run docs:api to refresh.
| Input | Type | Default | Description |
|---|---|---|---|
label | string | null | null | Programmatic label when projection is not used. Ignored when projected content is present only if `label` is unset — do not combine with projected text. |
type | SenseButtonType | 'button' | Native button `type` attribute. |
variant | SenseSurfaceVariant | 'filled' | Canonical surface treatment per ADR-0030 (`filled`, `outlined`, `ghost`). |
appearancedeprecated | SenseButtonAppearance | 'solid' | Visual style — solid, outline, ghost, or link. Deprecated: Prefer `variant`. Use `appearance="link"` only for link-style buttons. |
severity | SenseButtonSeverity | 'primary' | Semantic colour role. |
size | SenseButtonSize | 'md' | Button scale token. |
icon | SenseIconName | null | null | Optional leading/trailing icon glyph. |
iconPosition | SenseButtonIconPosition | 'left' | Icon placement when `icon` is set. |
iconOnly | boolean | false | Square icon-only layout — requires `ariaLabel`. |
loading | boolean | false | Shows spinner, sets `aria-busy`, and disables interaction. |
disabled | boolean | false | Disables the native button. |
fullWidth | boolean | false | Stretches to container width. |
pill | boolean | false | Pill border radius. |
badge | string | number | null | null | Overlay badge count via `sense-badge`. |
badgeColor | SenseBadgeSeverity | 'danger' | Badge colour passed to `sense-badge`. |
ariaLabel | string | null | null | Accessible name override for icon-only or custom labelling. |
loadingLabel | string | null | null | Accessible name while `loading` is true; falls back to i18n `button.loading`. |
autofocus | boolean | false | Focuses the native button after the first render when true. |
pressed | boolean | undefined | undefined | Toggle/segmented state forwarded as `aria-pressed` on the native button. Leave unset on plain action buttons so the attribute is omitted. |
| Output | Type | Description |
|---|---|---|
clicked | MouseEvent | Emitted when the native button is clicked and not disabled/loading. |
buttonFocus | FocusEvent | Emitted when the native button receives focus. |
buttonBlur | FocusEvent | Emitted when the native button loses focus. |
Accessibility
- ARIA attributes live on the native
<button>, not the host. loadingsetsaria-busy="true"and disables interaction.iconOnlyrequiresariaLabel(i18n fallback:button.iconOnly).- Bind
pressedonly for toggle/segmented controls (e.g. tab groups).