Component

Range Slider Input

Range slider components for numeric value selection

  • Component
  • Tailwind
  • MIT

Preview

Live component

Interactive preview
Open preview
9:41 100%
devsnips.dev/library/tailwind/components/input/range-slider/
fluid · no fixed width 100%
No dependencies Production-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Input/range-slider
registry path: Tailwind/Components/Input/range-slider

Source

Implementation

code.html
<!-- Range Slider - Standard -->
<div>
  <label class="block text-sm font-medium text-gray-700 mb-2">Volume</label>
  <input type="range" min="0" max="100" value="50" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-blue-600" />
</div>

<!-- Range Slider - With Labels -->
<div class="mt-6">
  <div class="flex justify-between items-center mb-2">
    <label class="text-sm font-medium text-gray-700">Price Range</label>
    <span class="text-sm text-gray-500">$50 - $200</span>
  </div>
  <div class="relative">
    <input type="range" min="0" max="250" value="50" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-blue-600" />
    <div class="absolute top-0 left-0 h-2 bg-blue-600 rounded-l-lg" style="width: 20%"></div>
  </div>
  <div class="flex justify-between text-xs text-gray-400 mt-1">
    <span>$0</span>
    <span>$250</span>
  </div>
</div>

<!-- Range Slider - Dual Handle -->
<div class="mt-6">
  <div class="flex justify-between items-center mb-2">
    <label class="text-sm font-medium text-gray-700">Dual Range</label>
    <span class="text-sm text-blue-600 font-medium">$100 - $180</span>
  </div>
  <div class="relative h-2 bg-gray-200 rounded-lg">
    <div class="absolute h-full bg-gradient-to-r from-blue-500 to-purple-500 rounded-lg" style="left: 30%; width: 40%"></div>
  </div>
  <div class="flex justify-between -mt-3">
    <button class="w-6 h-6 bg-white border-2 border-blue-500 rounded-full shadow-sm cursor-pointer"></button>
    <button class="w-6 h-6 bg-white border-2 border-purple-500 rounded-full shadow-sm cursor-pointer"></button>
  </div>
</div>

<!-- Range Slider - Steps -->
<div class="mt-6">
  <label class="block text-sm font-medium text-gray-700 mb-3">Brightness</label>
  <div class="flex items-center gap-4">
    <svg class="w-5 h-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
    </svg>
    <input type="range" min="0" max="100" value="75" step="25" class="flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-amber-500" />
    <svg class="w-5 h-5 text-amber-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
    </svg>
  </div>
  <div class="flex justify-center gap-6 mt-2 text-xs text-gray-500">
    <span>0%</span>
    <span>25%</span>
    <span>50%</span>
    <span>75%</span>
    <span>100%</span>
  </div>
</div>
57 lines UTF-8 · LF · Spaces: 2

AI-ready

Available to your agent.

This component is reachable through the DevSnips CLI, MCP server and Skills integrations — one registry, one resource path.

Resource path

devsnips://components/input/range-slider

Continue browsing

View all