Mohammad Shehadeh

Duration Input

Forms 1

About

Segmented duration field over days, hours, minutes and seconds. Digits auto-advance, arrows step, and the value stays a plain number of seconds.

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

Code

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

Usage.tsx

import * as React from "react";
import {
  DurationInput,
  DurationInputContainer,
  DurationInputSegments,
  DurationInputClear,
} from "@/components/ui/duration-input";

export default function DurationInputDemo() {
  const [value, setValue] = React.useState<number | null>(3600 + 5 * 60);

  return (
    <div className="flex w-full max-w-xs flex-col gap-2">
      <label className="text-sm font-medium">Session length</label>
      <DurationInput
        value={value}
        onValueChange={setValue}
        units={["h", "m", "s"]}
        max={86400}
      >
        <DurationInputContainer>
          <DurationInputSegments />
          <DurationInputClear />
        </DurationInputContainer>
      </DurationInput>
    </div>
  );
}

Dependencies

More by Mohammad Shehadeh

View all
  • Feature Problem Cards

    Feature Problem Cards

    90
  • Feature Grid Spotlight Cards

    Feature Grid Spotlight Cards

    73
  • Ecommerce Category Page

    Ecommerce Category Page

    72
  • Split Login

    Split Login

    69
  • Comparison Section

    Comparison Section

    65
  • Dithered Shader CTA

    Dithered Shader CTA

    64
  • Comparison Table

    Comparison Table

    64
  • FAQ Two Column

    FAQ Two Column

    63

More in Forms

View all
  • Premium Auth

    Premium Auth

    524
  • Contact Card

    Contact Card

    1K
  • Book A Demo 1

    Book A Demo 1

    73
  • Form

    Form

    16
  • Login 1

    Login 1

    53
  • Book A Demo 3

    Book A Demo 3

    89
  • Hand-Drawn Checkbox

    Hand-Drawn Checkbox

    48
  • Login Card

    Login Card

    6

Explore more

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