Özer

Slider Detents

Forms 19

About

A controlled range slider with magnetic detents that pull the thumb to notable values, with a live formatted readout, keyboard support and optional haptics.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Slider Detents to your project and fits it to your theme.

Code

How Slider Detents is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { SliderDetents } from "@/components/ui/slider-detents";
import { useState } from "react";

const SPEEDS = [
  { value: 0.5, label: "0.5×" },
  { value: 1, label: "Normal" },
  { value: 1.5, label: "1.5×" },
  { value: 2, label: "2×" },
];

const speed = (v: number) => `${v.toFixed(2)}×`;

export default function SliderDetentsDemo() {
  const [rate, setRate] = useState(1);

  return (
    <div className="flex w-full items-center justify-center px-6 py-16">
      <div className="w-full max-w-sm">
        <SliderDetents
          label="Playback speed"
          value={rate}
          min={0.25}
          max={2}
          step={0.05}
          detents={SPEEDS}
          format={speed}
          onValueChange={setRate}
        />
      </div>
    </div>
  );
}

Dependencies

More by Özer

View all
  • Password Strength

    Password Strength

    1.3K
  • OTP Input

    OTP Input

    799
  • Loading Button

    Loading Button

    599
  • Progress Bar

    Progress Bar

    586
  • Reorder List

    Reorder List

    308
  • Task Steps

    Task Steps

    275
  • Hold to Confirm

    Hold to Confirm

    249
  • Reading Progress

    Reading Progress

    168

More in Forms

View all
  • Premium Auth

    Premium Auth

    497
  • Login 2

    Login 2

    7
  • Authentication Card

    Authentication Card

    45
  • Login 1

    Login 1

    52
  • Contact Card

    Contact Card

    1K
  • Form

    Form

    16
  • Form

    Form

    136
  • Card Studio

    Card Studio

    41

Explore more

Part of interior.dev — browse the full library on 21st.dev.