Import the public directive from the published package entrypoint.

button.ts
import { KuiButtonDirective, kuiProvideButtonOptions } from '@kikita-labs/ui';

Use native button semantics for commands and anchor semantics for navigation.

Button docs
<div class="button-example">
  <button kuiButton type="button">Save changes</button>
  <button kuiButton type="button" shape="soft">Cancel</button>
  <a kuiButton routerLink="/components/button">Button docs</a>
</div>

shape controls the surface treatment (solid/soft/outline/ghost); appearance controls semantic color (primary/danger/success/warning). The two axes combine freely.

<div class="button-appearance-example">
  <button kuiButton type="button">Solid</button>
  <button kuiButton type="button" shape="soft">Soft</button>
  <button kuiButton type="button" shape="outline">Outline</button>
  <button kuiButton type="button" shape="ghost">Ghost</button>
  <button kuiButton type="button" appearance="danger">Danger</button>
  <button kuiButton type="button" shape="outline" appearance="danger">Outline danger</button>
</div>

Use the shared Kikita size scale, native disabled state, and the loading state for pending actions.

<div class="button-size-example">
  <button kuiButton type="button" size="xs">Extra small</button>
  <button kuiButton type="button" size="sm">Small</button>
  <button kuiButton type="button" size="md">Medium</button>
  <button kuiButton type="button" size="lg">Large</button>
  <button kuiButton type="button" disabled>Disabled</button>
  <button kuiButton type="button" loading>Loading</button>
</div>

Use iconStart/iconEnd for a registered icon name instead of hand-projecting kui-icon. Icon-only actions use kuiIconButton's icon input the same way.

<div class="button-icon-example">
  <button kuiButton shape="soft" appearance="success" iconStart="check" type="button">Save</button>
  <button kuiButton shape="outline" iconEnd="arrow-right" type="button">Continue</button>
  <button
    kuiIconButton
    shape="soft"
    appearance="danger"
    icon="trash-2"
    aria-label="Delete"
    type="button"
  ></button>
</div>

Use kuiProvideButtonOptions for repeated button-family defaults in a feature or application shell. Local inputs still win.

feature.providers.ts
import { kuiProvideButtonOptions } from '@kikita-labs/ui';

export const featureProviders = [
  kuiProvideButtonOptions({
    button: { shape: 'ghost', appearance: 'primary', size: 'sm' },
    iconButton: { shape: 'outline', size: 'sm' },
  }),
];

Inputs and provider defaults verified against @kikita-labs/ui v1.6.1 public typings.

NameTypeDefaultDescription
shape'solid' | 'soft' | 'outline' | 'ghost''solid'Surface treatment. Defaults to solid. Combines freely with appearance.
appearance'primary' | 'danger' | 'success' | 'warning' | nullnullSemantic color intent. Without an explicit value, solid/soft use primary colors and outline/ghost use neutral defaults.
size'xs' | 'sm' | 'md' | 'lg''md'Control height and spacing size.
wrapbooleanfalseAllows long button text to wrap instead of truncating in narrow containers.
disabledbooleanfalseDisables native button behavior. Anchor buttons receive aria-disabled and leave tab order.
loadingbooleanfalseCenters a kui-loader spinner over the button content, preserves layout size, sets aria-busy, and behaves like disabled.
iconStartKuiIconName | undefinedundefinedRenders a kui-icon resolved by name before the projected content, without hand-projecting kui-icon.
iconEndKuiIconName | undefinedundefinedRenders a kui-icon resolved by name after the projected content, without hand-projecting kui-icon.
kuiProvideButtonOptions(options)Provider-Scopes repeated defaults for kuiButton and kuiIconButton. Local inputs win over button options, and button options win over root defaults.size.
KUI_BUTTON_OPTIONSInjectionToken<KuiButtonOptions>-Provider token behind button-family defaults, with separate button and iconButton branches.

Button keeps native element behavior instead of replacing it with ARIA roles.

  • Use <button> for in-page commands and form actions.
  • Use <a> only for real navigation with an href.
  • Prefer visible text labels. Icon-only actions should use kuiIconButton.
  • Disabled anchor buttons are removed from tab order and receive aria-disabled.
  • loading keeps the button's original content in layout, centers a spinner over it, sets aria-busy="true", and behaves like disabled until it clears.