Button
Directive for applying Kikita UI button styling to native button and anchor elements.
Import the public directive from the published package entrypoint and the style entrypoint once in the application.
import {
KuiButton,
type KuiButtonAppearance,
type KuiButtonShape,
provideKuiDefaults,
} from '@kikita-labs/ui';Use native button semantics for commands and anchor semantics for navigation.
<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. Without an explicit appearance, solid and soft use primary colors and outline and ghost use their neutral defaults.
<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. A loading button keeps full opacity and its layout size while a spinner covers the content.
<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><button kuiButton appearance="success">
<kui-icon [source]="checkIcon" />
Save
</button>Long labels truncate by default; wrap lets them use several lines. An anchor host is for navigation, and a disabled anchor leaves the tab order and suppresses navigation.
<div class="button-wrap-example">
<button kuiButton type="button">Save changes and continue to the review step</button>
<button kuiButton type="button" wrap>Save changes and continue to the review step</button>
</div><div class="button-link-example">
<a kuiButton shape="outline" routerLink="/components/button">Open the Button page</a>
<a kuiButton shape="outline" routerLink="/components/button" disabled>Disabled link</a>
</div>Set defaults.button once for the application or for a subtree. Each option resolves as local input > defaults.button.<option> > built-in default.
import { provideKikitaUi } from '@kikita-labs/ui';
export const appConfig: ApplicationConfig = {
providers: [
provideKikitaUi({
defaults: {
button: {
/* options below */
},
},
}),
],
};import { provideKuiDefaults } from '@kikita-labs/ui';
export const featureProviders = [
provideKuiDefaults({
button: { shape: 'ghost', appearance: 'primary', size: 'sm' },
iconButton: { shape: 'outline', size: 'sm' },
}),
];| Name | Type | Default | Description |
|---|---|---|---|
| shape | 'solid' | 'soft' | 'outline' | 'ghost' | — | Default surface shape. |
| appearance | 'primary' | 'danger' | 'success' | 'warning' | null | — | Default semantic color intent. Use null for each shape's neutral/default appearance. |
| size | 'xs' | 'sm' | 'md' | 'lg' | — | Default button size. Takes precedence over the global defaults.size. |
Set any of these on the component or an ancestor to restyle one part. Each token is optional: when it is not set, the part uses the role or scale token in the default column.
| Name | Type | Default | Description |
|---|---|---|---|
| --kui-btn-solid-bg / -bg-hov / -bg-act | CSS custom property | - | Fill, hover and active fill of the default and primary appearances. |
| --kui-btn-solid-fg | CSS custom property | - | Label color of the default, primary, success and warning appearances. |
| --kui-btn-danger-bg / -bg-hov / -bg-act | CSS custom property | - | Fill, hover and active fill of the danger appearance. |
| --kui-btn-danger-fg | CSS custom property | - | Label color of the solid danger appearance. |
| --kui-btn-success-bg / -bg-hov / -bg-act | CSS custom property | - | Fill, hover and active fill of the success appearance. |
| --kui-btn-warning-bg / -bg-hov / -bg-act | CSS custom property | - | Fill, hover and active fill of the warning appearance. |
| --kui-btn-soft-* / --kui-btn-outline-* / --kui-btn-ghost-* | CSS custom property | - | Surface tokens of the soft, outline and ghost shapes for the default appearance. Status appearances read the matching --kui-color-<status>-soft-* semantic tokens. |
| Name | Type | Default | Description |
|---|---|---|---|
| --kui-btn-height-xs | CSS custom property | --kui-control-height-xs | Height, xs |
| --kui-btn-padding-inline-xs | CSS custom property | --kui-space-2 | Padding, inline xs |
| --kui-btn-height-sm | CSS custom property | --kui-control-height-sm | Height, sm |
| --kui-btn-padding-inline-sm | CSS custom property | --kui-space-3 | Padding, inline sm |
| --kui-btn-height-lg | CSS custom property | --kui-control-height-lg | Height, lg |
| --kui-btn-padding-inline-lg | CSS custom property | --kui-space-5 | Padding, inline lg |
Inputs, provider defaults and theming tokens verified against @kikita-labs/ui v2.0.0 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| shape | 'solid' | 'soft' | 'outline' | 'ghost' | 'solid' | Surface treatment. Combines freely with appearance. |
| appearance | 'primary' | 'danger' | 'success' | 'warning' | null | null | Semantic color intent. Without an explicit value, solid and soft use primary colors and outline and ghost use their neutral defaults. |
| size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Control height and spacing size. Falls back to defaults.button.size, then the global defaults.size. |
| wrap | boolean | false | Allows long button text to wrap instead of truncating in narrow containers. |
| disabled | boolean | false | Disables button behavior. A button host gets the native disabled attribute; an anchor host gets aria-disabled="true", leaves the tab order and suppresses navigation. |
| loading | boolean | false | Centers a kuiLoader spinner over the button content, fades the content out while keeping its layout size, sets aria-busy="true" and behaves like disabled. The button keeps full opacity instead of dimming like a disabled one. |
| iconStart | KuiIconName | undefined | undefined | Renders a kui-icon resolved by registered name before the projected content, without hand-projecting kui-icon. |
| iconEnd | KuiIconName | undefined | undefined | Renders a kui-icon resolved by registered name after the projected content, without hand-projecting kui-icon. |
| provideKuiDefaults({ button }) | (defaults: KuiComponentDefaults) => Provider | - | Scopes repeated defaults for kuiButton in a component, route or feature subtree. A nested level merges with its parent per property. Use the defaults option of provideKikitaUi for the whole application. |
| KuiButtonOptions | interface | - | Shape of defaults.button: shape, appearance (null selects each shape neutral appearance) and size. It is the same shape as KuiButtonBaseOptions, shared with defaults.iconButton. |
| KuiDefaults | service | - | Injectable that reads and writes defaults at runtime: get(key) returns a Signal of the effective options, set and update write to the nearest level. |
| KuiButtonShape / KuiButtonAppearance | type aliases | - | Public unions of the shape and appearance values, exported for typed wrappers. |
| kuiProvideButtonOptions | deprecated function | - | Forwards { button, iconButton } (KuiButtonProviderOptions) to provideKuiDefaults. Deprecated, removed in 3.0; use provideKuiDefaults. |
Button keeps native element behavior instead of replacing it with ARIA roles.
Consumer-visible changes of @kikita-labs/ui 2.0 for buttons.
// 1.x (deprecated, removed in 3.0)
providers: [kuiProvideButtonOptions({ button: { shape: 'ghost' } })];
// 2.0
providers: [provideKuiDefaults({ button: { shape: 'ghost' } })];