Formulários
VNumberInput
Campo numérico com stepper, prefixo/sufixo e validação min/max.
<script setup lang="ts">
import { VNumberInput } from 'vueui-nova-kit'
</script>Uso
<script setup lang="ts">
</script>
<template>
</template>Playground
Os controles abaixo são gerados a partir das props declaradas em VNumberInput.types.ts; o código acompanha cada mudança.
Exemplos
Variantes, tamanhos e estados, extraídos das stories da biblioteca.
Default
Variação Padrão. Estado padrão do componente; use a aba Controls para experimentar as props ao vivo. Props: label="Quantity", modelValue=42.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(42)
</script>
<template>
<VNumberInput v-model="value" label="Quantity" />
</template>Currency
Variação Currency. Props: label="Price", modelValue=99, prefix="$", placeholder="0.00", helperText="Base product price".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(99)
</script>
<template>
<VNumberInput
v-model="value"
label="Price"
prefix="$"
placeholder="0.00"
helper-text="Base product price" />
</template>Percentage
Variação Percentage. Props: label="Discount", modelValue=25, suffix="%", helperText="Applied at checkout".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(25)
</script>
<template>
<VNumberInput
v-model="value"
label="Discount"
suffix="%"
helper-text="Applied at checkout" />
</template>Min Max
Variação Min Max. Props: label="Inventory", modelValue=10, min=0, max=1000, helperText="Minimum of 0, maximum of 10…".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(10)
</script>
<template>
<VNumberInput
v-model="value"
label="Inventory"
:min="0"
:max="1000"
helper-text="Minimum of 0, maximum of 1000" />
</template>Error
Variação Erro. Props: label="Discount", min=0, errorMessage="Must be ≥ 0".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(-1)
</script>
<template>
<VNumberInput
v-model="value"
label="Discount"
:min="0"
error-message="Must be ≥ 0" />
</template>Disabled
Variação Desabilitado. Props: label="Quantity", modelValue=42, disabled=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(42)
</script>
<template>
<VNumberInput v-model="value" label="Quantity" disabled />
</template>Sizes
Variação Tamanhos.
Ver código
<script setup lang="ts">
import { VNumberInput } from 'vueui-nova-kit'
</script>
<template>
<div style="display:flex;flex-direction:column;gap:16px;max-width:320px">
<VNumberInput size="sm" label="Small" :model-value="12" />
<VNumberInput size="md" label="Medium" :model-value="42" />
<VNumberInput size="lg" label="Large" :model-value="100" />
</div>
</template>Product Pricing
Variação Product Pricing. Interativo: o estado é mantido na própria story (v-model).
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const price = ref(29.99)
const discount = ref(10)
const inventory = ref(100)
</script>
<template>
<div style="display:flex;flex-direction:column;gap:16px;max-width:320px">
<VNumberInput v-model="price" label="Price" prefix="$" helper-text="Base product price" :min="0" />
<VNumberInput v-model="discount" label="Discount" suffix="%" helper-text="Applied at checkout" :min="0" :max="100" />
<VNumberInput v-model="inventory" label="Inventory" helper-text="Units in stock" :min="0" />
</div>
</template>Readonly Required
Variação Somente leitura obrigatório. Props: label="Quantidade", modelValue=5, readonly=true, required=true.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(5)
</script>
<template>
<VNumberInput v-model="value" label="Quantidade" readonly required />
</template>Step
Variação Step. Props: label="Passo de 5", modelValue=10, step=5, min=0, max=100.
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(10)
</script>
<template>
<VNumberInput
v-model="value"
label="Passo de 5"
:step="5"
:min="0"
:max="100" />
</template>Scrub Interaction
Variação Scrub Interaction. Props: label="Arraste para alterar", modelValue=50, interaction="scrub".
Ver código
<script setup lang="ts">
import { ref } from 'vue'
import { VNumberInput } from 'vueui-nova-kit'
const value = ref(50)
</script>
<template>
<VNumberInput v-model="value" label="Arraste para alterar" />
</template>Acessibilidade
- Keyboard support (ArrowUp / ArrowDown) — ajustar valor sem rato; stepper focável e operável por teclado.
- Proper labels and aria attributes —
labelassociado (for),aria-label/aria-describedbypara prefixo/sufixo e ajuda. - Validation errors announced to screen readers — erro (
Must be ≥ 0) viaaria-live/role="alert", comaria-invalid="true". - Sufficient target size (minimum 44x44px) — botões do stepper com área de acerto mínima.
- Supports min, max, step constraints — expostos como atributos
min/max/stepearia-valuemin/aria-valuemax/aria-valuenow(semânticaspinbutton). - Compatible with screen readers — valor e limites anunciados; prefixo/sufixo não poluem a leitura.
- Clear focus indication — anel de foco sempre visível via
:focus-visible, nunca removido sem substituto.
Estados
Default · Hover · Focus · Pressed stepper · Invalid · Disabled.
Motion
Step feedback scale 100ms · hover/focus 100ms ease-out.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
modelValue | number | null | null | — |
label | string | — | — |
helperText | string | — | — |
errorMessage | string | — | — |
placeholder | string | — | — |
disabled | boolean | false | — |
readonly | boolean | false | — |
required | boolean | false | — |
size | VNumberInputSize | "md" | — |
min | number | — | — |
max | number | — | — |
step | number | 1 | — |
prefix | string | — | — |
suffix | string | — | — |
name | string | — | — |
id | string | — | — |
motion | VMotionLevel | V_MOTION_DEFAULT ("expressive") | — |
interaction | VNumberInputInteraction | "scrub" | Scrub Field: drag horizontally to change value. |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: number | null | — |
@focus | payload: FocusEvent | — |
@blur | payload: FocusEvent | — |
@increment | — | — |
@decrement | — | — |
Slots
Sem slots.
Fonte: src/components/form/VNumberInput/VNumberInput.vue · tipos: src/components/form/VNumberInput/VNumberInput.types.ts