TidalUI

Duration input preview

Enter an exact numeric duration with consumer-defined units and bounds.

pro · Forms · composite

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add @tidal-pro/duration-input

Import components/ui/tidal.css, components/ui/duration-input.css. Wrap installed components in tidal-scope.

Preview

Duration input component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/duration-input.css";
import{TidalDurationInput}from"./components/ui/duration-input";
export default()=><div className="tidal-scope"><TidalDurationInput label={"Demo"} onUnitChange={() => {}} onValueChange={() => {}} unit={"value"} units={[{value:"value",label:"Demo"}]} value={"value"}/></div>;

API and props

TidalDurationInput.label (required)
ReactNode

Required label value accepted by this exported component.

TidalDurationInput.onUnitChange (required)
(unit: string, event: ChangeEvent<HTMLSelectElement>) => void

Callback invoked when the unit change interaction is proposed.

TidalDurationInput.onValueChange (required)
(value: string, event: DurationEvent) => void

Callback invoked when the value change interaction is proposed.

TidalDurationInput.unit (required)
string

Required unit value accepted by this exported component.

TidalDurationInput.units (required)
ReadonlyArray<TidalDurationUnit>

Required units value accepted by this exported component.

TidalDurationInput.value (required)
string

Required value value accepted by this exported component.

TidalDurationInput.decrementButtonProps
StepButtonProps | undefined

Optional decrement button props value accepted by this exported component.

TidalDurationInput.decrementButtonRef
Ref<HTMLButtonElement> | undefined

Optional decrement button ref value accepted by this exported component.

TidalDurationInput.description
ReactNode

Optional description value accepted by this exported component.

TidalDurationInput.disabled
boolean | undefined

Optional disabled value accepted by this exported component.

TidalDurationInput.error
ReactNode

Optional error value accepted by this exported component.

TidalDurationInput.incrementButtonProps
StepButtonProps | undefined

Optional increment button props value accepted by this exported component.

TidalDurationInput.incrementButtonRef
Ref<HTMLButtonElement> | undefined

Optional increment button ref value accepted by this exported component.

TidalDurationInput.labels
Partial<{ value: string; unit: string; decrement: string; increment: string; required: string; invalidConfiguration: string; }> | undefined

Optional labels value accepted by this exported component.

TidalDurationInput.readOnly
boolean | undefined

Optional read only value accepted by this exported component.

TidalDurationInput.unitSelectProps
UnitSelectProps | undefined

Optional unit select props value accepted by this exported component.

TidalDurationInput.unitSelectRef
Ref<HTMLSelectElement> | undefined

Optional unit select ref value accepted by this exported component.

TidalDurationInput.valueInputProps
ValueInputProps | undefined

Optional value input props value accepted by this exported component.

TidalDurationInput.valueInputRef
Ref<HTMLInputElement> | undefined

Optional value input ref value accepted by this exported component.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas