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 { KuiNumberInputDirective } 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 b, with minus/plus controls on the sides, is the default and recommended for most use cases. variant a stacks compact arrow controls on the right.
<input
type="number"
kuiNumberInput
variant="a"
min="0"
max="99"
aria-label="Compact quantity"
value="12"
/>
<input
type="number"
kuiNumberInput
variant="b"
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>Inputs verified against @kikita-labs/ui v1.6.1 public typings.
| Name | Type | Default | Description |
|---|---|---|---|
| size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Control height from --kui-control-height-*. Generated buttons scale to match. |
| variant | 'a' | 'b' | 'b' | Button layout. b places minus/plus controls on the sides (recommended). a stacks compact arrow controls on the right. |
| 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-number-input-border | CSS custom property | --kui-color-border | Border color in the default state. |
| --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. |
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 use
aria-label="Decrease value"andaria-label="Increase value", 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 accelerating auto-increment after a 400 ms delay.
- Place the input inside
kui-fieldto inherit label, hint, error, and id wiring instead of wiring ARIA by hand.