Defaults
Set shared preferences such as size, shape, clearable or toast placement once for the application or for a subtree, instead of repeating them in every template.
Defaults cover preferences shared by many instances. Data, instance state and form state are never defaults.
| Name | Type | Default | Description |
|---|---|---|---|
| Colour, radius, spacing, type | Theme seeds and CSS variables | — | Visual identity of the whole application. |
| Variant or behaviour shared across the app | Defaults | — | Size, shape, clearable, toast placement and similar preferences (this page). |
| Density | Theme seeds | — | Set seeds.density in the theme. |
| Texts and accessible names | Messages | — | See the Internationalization page. |
defaults is a flat map with one key per primitive plus the global control size. Every key points to a named options interface such as KuiButtonOptions or KuiSelectOptions.
provideKikitaUi({
defaults: {
size: 'sm',
button: { shape: 'ghost', size: 'md' },
select: { clearable: true, maxVisibleChips: 2 },
toast: { position: 'top-end', duration: 4000 },
},
});KuiComponentDefaults lists every key. Interfaces that share a meaning share a base (KuiButtonBaseOptions, KuiFieldControlOptions). Each component page lists its own options in the Provider defaults section.
The nearest value wins, and each level is merged over the defaults it inherits per component key and per property.
- Order: local input, then the nearest level, then parent levels, then
provideKikitaUidefaults, then the component default. - An omitted or
undefinedproperty inherits from the parent;false,0,''andnullare real values and override. - Arrays and functions are replaced as a whole, and a level never changes its parent.
- Several
provideKuiDefaultsorprovideKikitaUiproviders on one level combine in provider order, the later one winning per property.
Every property accepts a plain value or a Signal, and the whole defaults value may be a function that runs in an injection context.
@Service()
class ThemeState {
readonly shape = signal<KuiButtonShape>('solid');
}
provideKikitaUi({
defaults: () => ({ button: { shape: inject(ThemeState).shape } }),
});- Components read the effective value in a
computed, so changing the signal updates every affected component. A componentprovidersarray cannot readthis; put the state in a service and read it in a function. setandupdatewrite to the nearest level only, andKuiDefaultsnever exposes a writable signal.- Dialog, drawer and toast options are read each time one opens, so an open overlay keeps what it opened with, and a tooltip reads its options each time it shows. Toast
positionandmaxVisiblebelong to the shared region and follow a change of the default. Everything else follows runtime changes immediately. - Defaults live in the injector of each application instance, so concurrent server requests never share them. Do not keep a module-level
signalin an application config shared by requests; create it inside a function default or a service.
defaults.size applies to every primitive with a size input when neither the local input nor the component key sets one.
- Order: local input, then
defaults.<component>.size, thendefaults.size, thenmd. A primitive whose size type is narrower thanKuiSizeignores unsupported values;kui-calendarsupportssmandmd, so a globalxsleaves it atmd.kui-iconis excluded because its size is a raw CSS size. - Field controls (
kuiInput,kuiTextarea,kuiNumberInput,kuiColorInput,kuiCheckbox,kuiRadio,kuiSwitch) have their own key, and an explicit size on the parentkui-fieldwins over the control key: local size, then the parent field local size, thendefaults.<control>.size, thendefaults.field.size, thendefaults.size, thenmd. kuiSliderdoes not read the parent field.kui-fieldresolves local size,defaults.field.size,defaults.size,md.kuiSelect,kuiCombobox,kuiDatePickerandkuiTimePickerhave no size input and follow the parent field.kuiButtonandkuiIconButtonuse separate keys because their default shapes differ on purpose (solid for buttons, ghost for icon-only buttons): local input, thendefaults.buttonordefaults.iconButton, thendefaults.size.
A few keys resolve through a chain with a shared field key.
- Clearable: local input, then
defaults.<select|combobox|datePicker|timePicker>, thendefaults.field, then the component default. Select defaults tofalse; Combobox, Date Picker and Time Picker default totrue. defaults.select.multipleDisplay(chipsortext) sets how a multiple select shows its selection anddefaults.select.maxVisibleChipshow many chips it shows before the+Nchip.- Tooltip: local
triggerType, thendefaults.tooltip.triggerType, thenauto.autoshows on mouse hover and keyboard focus and toggles on touch tap,hoverdisables touch taps,clickuses click or keyboard activation everywhere andnonedisables the directive. Tooltip content stays supplemental; use a popover for links or buttons.
Anchored overlays share the placement and offset options and add their own.
| Name | Type | Default | Description |
|---|---|---|---|
| popover | placement, offset, align, arrow, triggerType, hoverDelay | — | Built-in: bottom, 8, center, false, click, 100. |
| menu | placement, offset, menuAlign, minWidth | — | Built-in: bottom, 4, start, none. |
| dropdown | maxHeight, offset, closeOnSelect, panelWidth | — | Built-in: 240px, 4, true, anchor. |
| tooltip | triggerType, placement | — | Built-in: auto, top. |
| dialog | size, appearance, dismissable, closable | — | Per kuiDialog call. Built-in: md, default, true, true. |
| drawer | side, size, closeOnBackdropClick, closeOnEscape, closable | — | Built-in: right, md, true, true, true. |
- Each option resolves as local input or call config, then
defaults.<overlay>, then the built-in default. kui-dropdownis also the panel ofkuiSelect,kuiCombobox,kuiDatePickerandkuiTimePicker, sodefaults.dropdownreaches those panels unless the control sets the input itself.kuiDialogandkuiDrawerread the defaults of the injector they are called from, so a nestedprovideKuiDefaultsapplies to dialogs opened inside it.
These keys follow local input, then defaults, then the built-in default.
| Name | Type | Default | Description |
|---|---|---|---|
| calendar, calendarRange | size, flat, showWeekend, showFooter, showPrevNav, showNextNav | — | Built-in: global size, false, true, false, true, true. The two keys are separate and share KuiCalendarViewOptions. |
| timePicker | clearable, format, hourStep, minuteStep, secondStep, showSeconds | — | Built-in: true, the hour cycle of the locale, 1, 1, 1, false. The directive pushes them into its panel. |
| carousel | itemsPerView, loop, autoplay, autoplayInterval, showArrows, showDots, draggable | — | Built-in: 1, false, false, 4000, true, true, true. |
| pagination | variant, siblingCount, boundaryCount, pageSizeOptions | — | Built-in: compact, 1, 1, [10, 25, 50, 100]. |
A date picker renders a calendar inside its panel, so a defaults.calendar entry reaches it unless the panel sets the input itself.
Every remaining primitive has a key. Each option resolves as local input, then defaults, then the built-in default; size follows the size chain above.
| Name | Type | Default | Description |
|---|---|---|---|
| badge, breadcrumbs, chip, emptyState, loader, segmented, table | size | — | |
| input, textarea, checkbox, radio, switch, colorInput | size | — | |
| numberInput | size, variant | — | |
| slider, progress | size, color | — | |
| accordion | size, mode, appearance | — | |
| alert | size, shape, showIcon, closable | — | |
| card | size, appearance | — | |
| tabs | size, variant, orientation | — | |
| stepper | size, orientation, linear, compact | — | |
| tree | size, mode | — | |
| group | size, orientation, collapsed, rounded | — | |
| avatar, avatarGroup | size, shape (avatarGroup also max) | — | |
| link | tone, underline | — | |
| separator | appearance, orientation, spacing | — | |
| skeleton | shape, animation | — | |
| fileUpload | size, variant, mode | — | |
| otpInput | size, mask, integerOnly | — | |
| barChart, lineChart, donutChart, scatterChart | size, legend | — |
Not configurable on purpose: values, open and loading state, disabled, readonly, validation state, data inputs (series, data, groups), ids, accessible names and library message text, and per-instance structure such as Select.multiple, Chip.removable or the OTP length.
The icons key replaces the glyphs components draw for themselves, one glyph per role or per component slot.
provideKikitaUi({ defaults: { icons: { close: MY_CLOSE }, select: { chevronIcon: MY_CHEVRON } } }); Order: defaults.<component>.<slot>Icon, then defaults.icons.<role>, then the built-in glyph. A glyph is plain icon data and an invalid one is ignored. The roles and the data format are listed on the Structural icons page; these are not the icons you pass to kui-icon by name.
The injection tokens are removed and the provider functions remain as deprecated wrappers until 3.0.
| Name | Type | Default | Description |
|---|---|---|---|
| kuiProvideButtonOptions({ button, iconButton }) | provideKuiDefaults({ button, iconButton }) | — | Deprecated wrapper, removed in 3.0. |
| kuiProvideFieldOptions(options) | provideKuiDefaults({ field: options }) | — | Deprecated wrapper, removed in 3.0. |
| kuiProvideSelectOptions(options) | provideKuiDefaults({ select: options }) | — | Deprecated wrapper, removed in 3.0. |
| kuiProvideComboboxOptions(options) | provideKuiDefaults({ combobox: options }) | — | Deprecated wrapper, removed in 3.0. |
| kuiProvideTooltipOptions(options) | provideKuiDefaults({ tooltip: options }) | — | Deprecated wrapper, removed in 3.0. |
| provideKuiToastOptions(options) | provideKuiDefaults({ toast: options }) | — | Deprecated wrapper, removed in 3.0. |
| provideKikitaUi({ tooltip }) | provideKikitaUi({ defaults: { tooltip } }) | — | Deprecated. |
| KuiButtonOptions { button, iconButton } | KuiButtonProviderOptions | — | Deprecated; KuiButtonOptions now describes one button (shape, appearance, size). |
| KuiButtonPrimitiveOptions | KuiButtonBaseOptions | — | Renamed. |
| KikitaUiDefaults | KuiComponentDefaults | — | Deprecated alias. |
A nested level now merges with its parent per property (before, a nested field provider replaced the whole parent object), and kuiDatePicker and kuiTimePicker read their own datePicker and timePicker keys before the field key.