Edu Calvo

Duration Picker

Forms 4

About

An accessible time-duration input with hours/minutes/seconds segments that support typing digits, arrow-key increments, and pointer drag to scrub values.

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

Code

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

Usage.tsx

"use client";

import DurationPicker, {
  formatDuration,
} from "@/components/ui/duration-picker";
import { useState } from "react";

export default function DurationPickerDemo() {
  const [timer, setTimer] = useState(90);
  const [countdown, setCountdown] = useState(5400);

  return (
    <div className="mx-auto flex w-full max-w-md flex-col items-center gap-8 px-4 py-8">
      <div className="flex flex-col items-center gap-2">
        <DurationPicker
          label="Timer"
          onValueChange={setTimer}
          units={["minutes", "seconds"]}
          value={timer}
        />
        <p className="text-muted-foreground text-xs">
          {formatDuration(timer, ["minutes", "seconds"])} selected
        </p>
      </div>

      <div className="flex flex-col items-center gap-2">
        <DurationPicker
          label="Meeting length"
          max={7200}
          min={0}
          onValueChange={setCountdown}
          step={5}
          value={countdown}
        />
        <p className="text-muted-foreground text-xs">
          {formatDuration(countdown)} selected
        </p>
      </div>

      <div className="flex flex-col items-center gap-2">
        <DurationPicker defaultValue={0} disabled label="Disabled" />
      </div>
    </div>
  );
}

Dependencies

More by Edu Calvo

View all
  • Scrollable Card Stack

    Scrollable Card Stack

    235
  • AI Task List

    AI Task List

    160
  • Siri Orb

    Siri Orb

    160
  • Cursor Follow

    Cursor Follow

    154
  • Pixel Flow Field

    Pixel Flow Field

    142
  • Agent Avatar

    Agent Avatar

    130
  • Gravity Stars

    Gravity Stars

    112
  • Coverflow Carousel

    Coverflow Carousel

    95

More in Forms

View all
  • Premium Auth

    Premium Auth

    500
  • Login 2

    Login 2

    7
  • Authentication Card

    Authentication Card

    47
  • Login 1

    Login 1

    52
  • Contact Card

    Contact Card

    1K
  • Login Form

    Login Form

    6
  • Form

    Form

    16
  • Book A Demo 3

    Book A Demo 3

    83

Explore more

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