Variants
Default
The label sits above the field. Steppers are at the trailing edge: ghost, icon-only NbButtons the size of the field, each as wide as the field is tall.
Fluid
The label sits inside the field, where a placeholder would be while it is empty, and steps up and shrinks once it has a value or focus. The helper is an icon on the value line. The field keeps the height of its size (xs is drawn at sm), like every fluid field.
vue
<template>
<NbNumberInput
v-model="count"
variant="fluid"
label="Editors"
:min="1"
:max="4"
/>
</template>Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | number | null | null | Current value (v-model) |
label | string | - | Label text |
placeholder | string | - | Placeholder shown when value is empty |
helper | string | - | Helper text below the field |
error | string | - | Error message: triggers error state |
warning | string | - | Warning message: triggers warning state |
min | number | - | Minimum allowed value |
max | number | - | Maximum allowed value |
step | number | 1 | Increment/decrement amount per button press |
variant | 'default' | 'fluid' | 'default' | Layout variant |
disabled | boolean | false | Disables the field and buttons |
required | boolean | false | Marks the field as required (adds *) |
id | string | auto | Native input id (auto-generated if omitted) |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | number | null | Emitted on every value change |
change | number | null | Also emitted on every value change |
Exposed
typescript
const inputRef = ref<InstanceType<typeof NbNumberInput>>()
inputRef.value?.focus()Behavior
- The user can type directly into the field. The value is clamped to
min/maxon blur or Enter. - The
−button is dimmed when the value equalsmin. - The
+button is dimmed when the value equalsmax.