Number Field
A number field lets users enter and adjust numeric values with optional increment and decrement controls.
Examples
Basic
| Prop | Default | Type | Description |
|---|---|---|---|
disabled | - | boolean | When true, prevents the user from interacting with the Number Field. |
disableWheelChange | - | boolean | When true, prevents the value from changing on wheel scroll. |
invertWheelChange | - | boolean | When true, inverts the direction of the wheel change. |
locale | - | string | The locale to use for formatting numeric values |
max | - | number | The largest value allowed for the input. |
min | - | number | The smallest value allowed for the input. |
modelValue | - | number | null | Value of the input. Can be binded as v-model. |
step | 1 | number | The amount that the input value changes with each increment or decrement "tick". |
stepSnapping | true | boolean | When false, prevents the value from snapping to the nearest increment of the step value. |
Variant & Color
| Prop | Default | Type | Description |
|---|---|---|---|
number-field | outline-primary | {variant}-{color} | Controls the visual style of the number field. |
| Variant | Description |
|---|---|
outline | The default variant. |
solid | The solid variant. |
~ | The unstyle or base variant |
Size
| Prop | Default | Type | Description |
|---|---|---|---|
size | md | string | Allows you to change the size of the number-field. |
🚀 Adjust number-field size freely using any size, breakpoints (e.g.,
sm:sm, xs:lg), or states (e.g.,hover:lg, focus:3xl).
The padding, icons, and text-size of the number-field scale are dynamically adjusted based on the size property. To customize the text-size and padding simultaneously, you can use utility classes.
Icons
| Prop | Default | Type | Description |
|---|---|---|---|
leading | - | string | The icon to display before the input. |
trailing | - | string | The icon to display after the input. |
Form Field
The NNumberField component can be easily embedded within the NFormField component.
Slots
| Name | Props | Description |
|---|---|---|
default | - | Allows advanced customization using sub-components, replacing the default number field structure. |
content | - | Replaces the entire content container, including increment, decrement and input. |
increment | - | Custom content for the number field increment. |
decrement | - | Custom content for the number field decrement. |
Custom Rendering
Use the default slot for complete control over the number field's structure. This lets you compose the number field using its individual sub-components (such as increment, decrement, and input elements, as listed in the Slots section), similar to approaches used in libraries like shadcn/ui.