Component
Number Stepper Input
Input fields with increment/decrement buttons for quantity selection
- Component
- Tailwind
- MIT
Preview
Live component
9:41 100%
devsnips.dev/library/tailwind/components/input/number-stepper/ fluid · no fixed width 100%
Install
Add to your project
npx devsnips add Tailwind/Components/Input/number-stepper Tailwind/Components/Input/number-stepper <!-- Number Stepper - Default -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Quantity</label>
<div class="inline-flex items-center border border-gray-300 rounded-lg">
<button class="px-4 py-2.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 border-r border-gray-300 rounded-l-lg transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4" />
</svg>
</button>
<input type="number" value="1" class="w-16 px-2 py-2.5 text-center border-0 focus:outline-none focus:ring-0" />
<button class="px-4 py-2.5 text-gray-600 hover:bg-gray-100 hover:text-gray-900 border-l border-gray-300 rounded-r-lg transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
</button>
</div>
</div>
<!-- Number Stepper - Compact -->
<div class="mt-6">
<label class="block text-sm font-medium text-gray-700 mb-2">Items</label>
<div class="inline-flex items-center border border-gray-200 rounded-lg bg-gray-50">
<button class="p-2 text-gray-500 hover:bg-gray-200 rounded-l-lg transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4" />
</svg>
</button>
<input type="number" value="5" class="w-12 px-1 py-1.5 text-center text-sm bg-transparent border-0 focus:outline-none" />
<button class="p-2 text-gray-500 hover:bg-gray-200 rounded-r-lg transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
</button>
</div>
</div>
<!-- Number Stepper - Pill -->
<div class="mt-6">
<label class="block text-sm font-medium text-gray-700 mb-2">Guests</label>
<div class="inline-flex items-center bg-white border-2 border-gray-200 rounded-full">
<button class="p-3 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4" />
</svg>
</button>
<input type="number" value="4" class="w-12 px-1 py-2 text-center font-semibold text-gray-900 bg-transparent border-0 focus:outline-none" />
<button class="p-3 text-gray-500 hover:text-blue-600 hover:bg-blue-50 rounded-full transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
</button>
</div>
</div>
<!-- Number Stepper - With Limits -->
<div class="mt-6">
<label class="block text-sm font-medium text-gray-700 mb-2">Tickets (max 10)</label>
<div class="inline-flex items-center border-2 border-blue-200 rounded-xl bg-blue-50">
<button class="p-3 text-blue-500 hover:bg-blue-100 rounded-l-xl transition-colors" disabled>
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4" />
</svg>
</button>
<input type="number" value="1" min="1" max="10" class="w-14 px-2 py-2.5 text-center font-semibold text-blue-700 bg-transparent border-0 focus:outline-none" />
<button class="p-3 text-blue-500 hover:bg-blue-100 rounded-r-xl transition-colors">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
</button>
</div>
</div> # Number Stepper
Numeric stepper input.
## Usage
```bash
npx devsnips add Tailwind/Components/Input/number-stepper
```
Copy from `code.html`.
## File Structure
`code.html` · `preview.html` · `metadata.json` · `README.md` 71 lines UTF-8 · LF · Spaces: 2
Continue browsing