Componentpickers0.87 KB gzipZero dependencies

Duration Input

Duration input: hour/minute/second steppers.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add duration-input

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { DurationInput } from "@/components/ui/duration-input"; <DurationInput />

Source code

duration-input.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxduration-input.tsx70 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface DurationValue {  hours: number;  minutes: number;  seconds?: number;} export interface DurationInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {  value?: DurationValue;  defaultValue?: DurationValue;  onValueChange?: (value: DurationValue) => void;  showSeconds?: boolean;  label?: string;}

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { DurationInput } from "@/components/ui/duration-input"; <DurationInput />
PropTypeDescription
valueDurationValueControlled value.
defaultValueDurationValueInitial value when uncontrolled. (Default: { hours: 0, minutes: 0 })
onValueChange(value: DurationValue) => voidCallback invoked on value change.
showSecondsbooleanToggles show seconds. (Default: false)
labelstringAccessible label text rendered or attached to the control. (Default: "Duration")