Skip to content

    Browse components

    Duration Picker

    Hours, minutes and a save button fused into one bar that pulls apart on a liquid thread while you edit.

    Credit: Calamansi UI (MIT)

    Open
    Customize
    calamansi
    white
    slate
    citrus
    sm
    md
    lg

    Installation

    npx shadcn@latest add @glint-ui/duration-picker

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/duration-picker.json

    Usage

    import { DurationPicker } from "@/components/ui/duration-picker";
    
    const [value, setValue] = useState({ hours: 1, minutes: 30 });
    
    <DurationPicker value={value} onChange={setValue} onConfirm={save} />

    Props

    PropTypeDefaultDescription
    variant"calamansi" | "white" | "slate" | "citrus""calamansi"Palette the save button and the bead wear.
    size"sm" | "md" | "lg""md"Bar height, and with it the corner, travel and field widths.
    maxHoursnumber24Ceiling for the hours field.
    maxMinutesnumber60Ceiling for the minutes field.
    hoursLabelstring"Hr."Unit after the hours field.
    minutesLabelstring"Min."Unit after the minutes field.
    thresholdnumber19Alpha ramp slope: how hard the fused edge is.
    gooeybooleantrueRun the metaball fuse. Off, the pieces just slide apart.
    beadbooleantrueLeave a drop of juice where the thread severs.
    disabledbooleanfalseDisable editing.
    valueReactNode—Controlled `{ hours, minutes }`.
    defaultValueReactNode—Initial `{ hours, minutes }` when uncontrolled.
    onChangeReactNode—`(value) => void`, fired on every keystroke with the clamped value.
    onConfirmReactNode—`(value) => void`, fired on save (tick or Enter).
    editingboolean—Hold the bar open or shut (controlled).
    defaultEditingbooleanfalseOpen on mount when uncontrolled.
    onEditingChangeReactNode—`(editing) => void`, fired when the pieces split or merge.
    gapnumber—How far the seams open on each side, in px (defaults per size).
    radiusnumber—Override the corner radius in px.
    viscositynumber—Fuse blur in px. Defaults to 0.55 of the gap.
    classNamestring—Extra classes for the root element.