Componentpickers0.87 KB gzipZero dependencies

TimeRangePicker

Two time inputs with duration readout that animates on change

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add time-range-picker

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { TimeRangePicker } from "@/components/ui/time-range-picker"; <TimeRangePicker defaultValue={['09:00', '17:00']} onValueChange={(v) => {}} />

Source code

time-range-picker.tsx + 1 helper

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

tsxtime-range-picker.tsx108 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface TimeRangePickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> {  value?: [string, string];  defaultValue?: [string, string];  onValueChange?: (value: [string, string]) => void;  className?: string;} function parseMinutes(hhmm: string): number | null {  const m = /^(\d{2}):(\d{2})$/.exec(hhmm.trim());  if (!m) return null;  const h = Number(m[1]);  const min = Number(m[2]);  if (h < 0 || h > 23 || min < 0 || min > 59) return null;

Props

PropTypeDescription
value[string, string]Controlled value.
defaultValue[string, string]Initial value when uncontrolled.
onValueChange(value: [string, string]) => voidCallback invoked on value change.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.