Number Input
kuiNumberInput applies Kikita UI number-input styling and increment/decrement controls to a native input[type=number] element.
Import the public number input directive from the package entrypoint.
import { KuiNumberInput } from '@kikita-labs/ui';Use kuiNumberInput on a native input[type=number] element. Standard HTML attributes such as min, max, step, disabled, readonly, and value are placed directly on the input.
<input type="number" kuiNumberInput min="0" max="100" aria-label="Quantity" value="4" />
<input
type="number"
kuiNumberInput
size="sm"
min="0"
max="10"
aria-label="Small quantity"
value="2"
/>
<input
type="number"
kuiNumberInput
disabled
min="0"
max="10"
aria-label="Disabled quantity"
value="3"
/>variant split, with minus/plus controls on the sides, is the default and recommended for most use cases. variant stacked puts compact arrow controls on the right.
<input
type="number"
kuiNumberInput
variant="stacked"
min="0"
max="99"
aria-label="Compact quantity"
value="12"
/>
<input
type="number"
kuiNumberInput
variant="split"
min="0"
max="99"
aria-label="Default quantity"
value="12"
/>Click a generated button to step by the step attribute, or by 1 when step is omitted. At min the decrement button disables; at max the increment button disables. invalid applies an error border.
<input
type="number"
kuiNumberInput
min="0"
max="20"
step="5"
aria-label="Step of five"
value="10"
/>
<input
type="number"
kuiNumberInput
invalid
min="1"
max="10"
aria-label="Invalid quantity"
value="0"
/>Place the input inside kui-field to inherit label, hint, error, and id wiring. A parent field error also marks the input invalid automatically.
<kui-field label="Seats" hint="Choose between 1 and 10 seats">
<input type="number" kuiNumberInput min="1" max="10" value="4" />
</kui-field>
<kui-field label="Discount" error="Discount must be at least 0%" required>
<input type="number" kuiNumberInput invalid min="0" max="100" value="-5" />
</kui-field>Use Angular Signal Forms [formField] on the same native input. When projected inside kui-field, the field wrapper reads the descendant [formField] and infers the required marker and first error message. Use Signal Forms min(...) and max(...) validators for range constraints instead of native min/max attributes on a [formField] input.
<kui-field label="Count" hint="Enter a value from 1 to 100">
<input type="number" kuiNumberInput [formField]="profileForm.count" />
</kui-field>Number Input uses the shared --kui-input-* control-chrome tokens for height, border, radius, background, text, placeholder, focus, and invalid states. Number-specific tokens remain available for the increment and decrement controls.
input[kuiNumberInput] {
--kui-input-bg: var(--kui-color-surface);
--kui-input-border: var(--kui-color-border);
--kui-input-radius: var(--kui-radius-md);
--kui-number-input-btn-bg-hover: var(--kui-color-surface-elevated);
}Set defaults.numberInput once for the application or for a subtree. Each option resolves as local input > defaults.numberInput.<option> > built-in default.
import { provideKikitaUi } from '@kikita-labs/ui';
export const appConfig: ApplicationConfig = {
providers: [
provideKikitaUi({
defaults: {
numberInput: {
/* options below */
},
},
}),
],
};| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | — | Component size. Takes precedence over the global defaults.size. |
| variant | 'stacked' | 'split' | — | Default variant. |
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-number-input-btn-color-hover | CSS custom property | --kui-color-text | Btn color, hover |
| --kui-number-input-btn-bg-active | CSS custom property | --kui-color-border | Btn background, active |
| --kui-number-input-btn-color-active | CSS custom property | --kui-color-text | Btn color, active |
| --kui-number-input-btn-color-disabled | CSS custom property | --kui-color-text-disabled | Btn color, disabled |
| --kui-number-input-arrow-color-hover | CSS custom property | --kui-color-text | Arrow color, hover |
| --kui-number-input-arrow-bg-active | CSS custom property | --kui-color-border | Arrow background, active |
| --kui-number-input-arrow-color-active | CSS custom property | --kui-color-text | Arrow color, active |
| --kui-number-input-arrow-color-disabled | CSS custom property | --kui-color-text-disabled | Arrow color, disabled |
| --kui-number-input-btn-color-readonly | CSS custom property | --kui-color-text-secondary | Btn color, readonly |
| Name | Type | Default | Description |
|---|---|---|---|
| --kui-number-input-field-padding-inline | CSS custom property | --kui-space-3 | Field padding, inline |
Every text the component owns (accessible names, visible words, announcements) is a typed message with an English default. Override it for the application with provideKikitaUi({ messages }), or for a subtree with provideKuiMessages.
| Name | Type | Default | Description |
|---|---|---|---|
| decrease | string | — | Decrease button. Default Decrease value. |
| increase | string | — | Increase button. Default Increase value. |
Inputs verified against @kikita-labs/ui v2.0.0 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | undefined | undefined | Control height from --kui-control-height-*; generated buttons scale to match. Resolved from defaults.numberInput.size, then the parent field, then the global defaults.size, then md. |
| variant | 'stacked' | 'split' | undefined | undefined | Button layout. split places minus/plus controls on the sides (recommended); stacked stacks compact arrows on the right. Falls back to defaults.numberInput.variant, then split. |
| invalid | boolean | false | Applies an error border. Also inherited automatically from a parent kui-field with an error. |
| id | string | undefined | - | Id override for the native input. Falls back to the parent kui-field control id. |
| min | string | number | - | Native HTML attribute placed directly on the input. Decrement stops and disables at this value. |
| max | string | number | - | Native HTML attribute placed directly on the input. Increment stops and disables at this value. |
| step | string | number | 1 | Native HTML attribute. Amount the generated buttons and arrow keys step by. |
| disabled | boolean | false | Native HTML attribute. Sets data-kui-disabled on the container and disables both generated buttons. |
| readonly | boolean | false | Native HTML attribute. Sets data-kui-readonly on the container and disables both generated buttons. |
| --kui-input-bg | CSS custom property | Field | Shared control background color. |
| --kui-input-bg-disabled | CSS custom property | var(--kui-input-bg) | Shared background color used for disabled and readonly states. |
| --kui-number-input-border | CSS custom property | --kui-input-border | Optional number-input border override; falls back to the shared input border. |
| --kui-number-input-divider | CSS custom property | --kui-color-border | Divider color between the buttons and the native input. |
| --kui-number-input-btn-bg | CSS custom property | transparent | Generated button background in the default state. |
| --kui-number-input-btn-bg-hover | CSS custom property | --kui-color-surface-elevated | Generated button background on hover. |
| --kui-number-input-btn-text | CSS custom property | --kui-color-text-secondary | Generated button icon color. |
| KuiNumberInputOptions | interface | - | Shape of defaults.numberInput: size and variant. |
The native input[type=number] keeps its built-in keyboard and screen-reader semantics.
- Provide an accessible name through
aria-labelor akui-fieldlabel. - Generated buttons are named by the
numberInput.decreaseandnumberInput.increasemessages (Decrease valueandIncrease valueby default), plus nativedisabledandaria-disabled="true"when stepping is not available. - Native keyboard behavior on the input remains available: ArrowUp, ArrowDown, Home, and End.
- Press and hold a generated button for repeated stepping after a 400 ms delay; Enter or Space on a focused button steps once.
- A disabled or readonly native input sets
data-kui-disabledordata-kui-readonlyon the container and disables both buttons. - Place the input inside
kui-fieldto inherit label, hint, error, and id wiring instead of wiring ARIA by hand.
Consumer-visible changes of @kikita-labs/ui 2.0 for Number Input.
- The directive class is
KuiNumberInput; theDirectivesuffix is gone. variantvalues aresplit(side controls, default) andstacked; the oldbandanames are gone.- Size and variant defaults moved to
provideKuiDefaults({ numberInput: { size, variant } }); the inputs are nowundefineduntil set. - The decrease and increase button names come from the
numberInput.decreaseandnumberInput.increasemessages. - Button hover, active, disabled and readonly states have colour tokens, and the field padding has
--kui-number-input-field-padding-inline.