Formulários

VNumberInput

Componentev-model11 exemplos18 propsA2UI · NumberInput

Campo numérico com stepper, prefixo/sufixo e validação min/max.

Importação
<script setup lang="ts">
import { VNumberInput } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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
vue
<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

  1. Keyboard support (ArrowUp / ArrowDown) — ajustar valor sem rato; stepper focável e operável por teclado.
  2. Proper labels and aria attributes — label associado (for), aria-label/aria-describedby para prefixo/sufixo e ajuda.
  3. Validation errors announced to screen readers — erro (Must be ≥ 0) via aria-live/role="alert", com aria-invalid="true".
  4. Sufficient target size (minimum 44x44px) — botões do stepper com área de acerto mínima.
  5. Supports min, max, step constraints — expostos como atributos min/max/step e aria-valuemin/aria-valuemax/aria-valuenow (semântica spinbutton).
  6. Compatible with screen readers — valor e limites anunciados; prefixo/sufixo não poluem a leitura.
  7. 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

PropTipoDefaultDescrição
modelValuenumber | nullnull—
labelstring——
helperTextstring——
errorMessagestring——
placeholderstring——
disabledbooleanfalse—
readonlybooleanfalse—
requiredbooleanfalse—
sizeVNumberInputSize"md"—
minnumber——
maxnumber——
stepnumber1—
prefixstring——
suffixstring——
namestring——
idstring——
motionVMotionLevelV_MOTION_DEFAULT ("expressive")—
interactionVNumberInputInteraction"scrub"Scrub Field: drag horizontally to change value.

Events

EventoPayloadDescrição
@update:modelValuevalue: number | null—
@focuspayload: FocusEvent—
@blurpayload: FocusEvent—
@increment——
@decrement——

Slots

Sem slots.

Fonte: src/components/form/VNumberInput/VNumberInput.vue · tipos: src/components/form/VNumberInput/VNumberInput.types.ts