ArtificialSenseDocs

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.

Inputs
InputTypeDefaultDescription
labelstring | nullnull Programmatic label when projection is not used. Ignored when projected content is present only if `label` is unset — do not combine with projected text.
typeSenseButtonType'button' Native button `type` attribute.
variantSenseSurfaceVariant'filled' Canonical surface treatment per ADR-0030 (`filled`, `outlined`, `ghost`).
appearancedeprecatedSenseButtonAppearance'solid' Visual style — solid, outline, ghost, or link. Deprecated: Prefer `variant`. Use `appearance="link"` only for link-style buttons.
severitySenseButtonSeverity'primary' Semantic colour role.
sizeSenseButtonSize'md' Button scale token.
iconSenseIconName | nullnull Optional leading/trailing icon glyph.
iconPositionSenseButtonIconPosition'left' Icon placement when `icon` is set.
iconOnlybooleanfalse Square icon-only layout — requires `ariaLabel`.
loadingbooleanfalse Shows spinner, sets `aria-busy`, and disables interaction.
disabledbooleanfalse Disables the native button.
fullWidthbooleanfalse Stretches to container width.
pillbooleanfalse Pill border radius.
badgestring | number | nullnull Overlay badge count via `sense-badge`.
badgeColorSenseBadgeSeverity'danger' Badge colour passed to `sense-badge`.
ariaLabelstring | nullnull Accessible name override for icon-only or custom labelling.
loadingLabelstring | nullnull Accessible name while `loading` is true; falls back to i18n `button.loading`.
autofocusbooleanfalse Focuses the native button after the first render when true.
pressedboolean | undefinedundefined Toggle/segmented state forwarded as `aria-pressed` on the native button. Leave unset on plain action buttons so the attribute is omitted.
Outputs
OutputTypeDescription
clickedMouseEventEmitted when the native button is clicked and not disabled/loading.
buttonFocusFocusEventEmitted when the native button receives focus.
buttonBlurFocusEventEmitted when the native button loses focus.

Accessibility

  • ARIA attributes live on the native <button>, not the host.
  • loading sets aria-busy="true" and disables interaction.
  • iconOnly requires ariaLabel (i18n fallback: button.iconOnly).
  • Bind pressed only for toggle/segmented controls (e.g. tab groups).