v1.3.0 28

Number Input

A numeric input with increment and decrement buttons for precise value control.

Interactive Requires: veritheme.js JS init: automatic

Default

html
<div class="vt-number-input" data-vt-number-input="">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="decrement" aria-label="Decrease">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <input type="number" value="1" min="0" max="99" class="vt-number-input-value" data-vt-number-value="" aria-label="Value">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="increment" aria-label="Increase">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
</div>

With Label

Number input paired with a label and helper text.

html

Select between 1 and 99

<div class="vt-field">
  <label class="vt-label" for="qty-input">Quantity</label>
  <div class="vt-number-input" data-vt-number-input="">
    <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="decrement" aria-label="Decrease">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
    <input id="qty-input" type="number" value="3" min="1" max="99" class="vt-number-input-value" data-vt-number-value="" aria-describedby="number-input-2-1">
    <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="increment" aria-label="Increase">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
  </div>
  <p class="vt-field-description" id="number-input-2-1">Select between 1 and 99</p>
</div>

Sizes

Small, medium, and large number input variants.

html
<div class="vt-number-input vt-number-input-sm" data-vt-number-input="">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon vt-btn-sm" data-vt-action="decrement" aria-label="Decrease">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-3 vt-h-3" aria-hidden="true">
      <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <input type="number" value="2" min="0" max="99" class="vt-number-input-value" data-vt-number-value="" aria-label="Value">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon vt-btn-sm" data-vt-action="increment" aria-label="Increase">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-3 vt-h-3" aria-hidden="true">
      <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
</div>

<div class="vt-number-input" data-vt-number-input="">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="decrement" aria-label="Decrease">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <input type="number" value="5" min="0" max="99" class="vt-number-input-value" data-vt-number-value="" aria-label="Value">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="increment" aria-label="Increase">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
</div>

<div class="vt-number-input vt-number-input-lg" data-vt-number-input="">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon vt-btn-lg" data-vt-action="decrement" aria-label="Decrease">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-5 vt-h-5" aria-hidden="true">
      <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <input type="number" value="8" min="0" max="99" class="vt-number-input-value" data-vt-number-value="" aria-label="Value">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon vt-btn-lg" data-vt-action="increment" aria-label="Increase">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-5 vt-h-5" aria-hidden="true">
      <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
</div>

Min / Max

Number input with min and max constraints. Buttons disable at boundaries.

html

Min: 1, Max: 10

<div class="vt-space-y-2 vt-text-center">
  <div class="vt-number-input" data-vt-number-input="">
    <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="decrement" disabled="" aria-label="Decrease">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
    <input type="number" value="1" min="1" max="10" class="vt-number-input-value" data-vt-number-value="" aria-label="Value" aria-describedby="number-input-4-1">
    <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" data-vt-action="increment" aria-label="Increase">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
  </div>
  <p class="vt-caption vt-text-foreground-muted" id="number-input-4-1">Min: 1, Max: 10</p>
</div>

Disabled

Disabled state for read-only display.

html
<div class="vt-number-input vt-disabled">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" disabled="" aria-label="Decrease">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <input type="number" value="5" disabled="" class="vt-number-input-value" aria-label="Value">
  <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon" disabled="" aria-label="Increase">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
</div>

Shopping Cart Example

Number input in a product card context.

html
🎧

Wireless Headphones

Premium noise canceling

$299
<div class="vt-card vt-card-sm vt-max-w-sm">
  <div class="vt-media-frame vt-media-landscape">
    <span class="vt-text-4xl">🎧</span>
  </div>
  <div class="vt-card-body">
    <div>
      <h3 class="vt-card-title">Wireless Headphones</h3>
      <p class="vt-card-description">Premium noise canceling</p>
    </div>
    <div class="vt-flex vt-items-center vt-justify-between">
      <span class="vt-text-lg vt-font-bold">$299</span>
      <div class="vt-number-input vt-number-input-sm" data-vt-number-input="">
        <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon vt-btn-sm" data-vt-action="decrement" disabled="" aria-label="Decrease">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-3.5 vt-h-3.5" aria-hidden="true">
            <path d="M20.9922 12L2.99219 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
          </svg>
        </button>
        <input type="number" value="1" min="1" max="10" class="vt-number-input-value" data-vt-number-value="" aria-label="Value">
        <button type="button" class="vt-btn vt-btn-ghost vt-btn-icon vt-btn-sm" data-vt-action="increment" aria-label="Increase">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-3.5 vt-h-3.5" aria-hidden="true">
            <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
          </svg>
        </button>
      </div>
    </div>
  </div>
</div>

Guidelines

Min: 1, Max: 10

Do Set min and max so steppers stop at valid bounds.
Don't Don't omit min and max when only a narrow range is valid.

API Reference

Class Type Description
vt-number-input Base The bordered field: buttons and value in one row, 40px tall
vt-btnvt-btn-ghostvt-btn-icon Part Decrement / increment — ghost icon buttons; add vt-btn-sm / vt-btn-lg with the field size (vt-number-input-btn still works)
vt-number-input-value Part The value, centered, 56px wide, with a divider on each side
vt-number-input-sm/vt-number-input-lg Size Small (32px) and large (48px) field
[data-vt-number-input][data-vt-action][data-vt-number-value] JS Wiring for the bundle: wrapper, decrement/increment, value
vt-disabled State Disabled field — subtle background, grayed value; disable the buttons and the input too

Accessibility

Feature Details
Keyboard Arrow keys work in the input, buttons are keyboard accessible via Tab
Screen Reader Input announces current value and constraints (min/max)
ARIA Use aria-label on increment/decrement buttons for clarity
Min/Max Buttons auto-disable at boundaries, preventing invalid values
Focus Input receives focus ring, buttons show hover/focus states