Time Range Form

Time range form card: start and end times typed as m:ss with the length worked out large between them, for a sound loop, a clip trim, a meeting slot or a shift, and an optional collapsible section for times that go with it, such as fades. Controlled or uncontrolled.

Installation

npx shadcn@latest add @01orbital/time-range-form

Usage

import { TimeRangeForm } from "@/components/time-range-form/time-range-form"

Needs props to render

Pass title, labels; see the API reference below.

Examples

Consoletime-range-form-console

Audio loop settings example showing the LoopSettingsForm as a console, with the fade in and out controls left exposed and monospace labels.

npx shadcn@latest add @01orbital/time-range-form-console

Anatomy

Time Range Form is built from 2 parts. In the example they nest like this:

TimeRangeForm
└─ TimeField
  • TimeRangeForm: A card for a span of time: start and end times typed as m:ss, with the length worked out large between them, for a sound loop, a clip trim, a meeting slot or a shift. The length shows a dash until both times read as times and the end comes after the start. Anything passed as children sits in a collapsible section under the range. Other props go to the Card.
  • TimeField: A labelled text field for an m:ss time, in tabular mono figures. Use it inside TimeRangeForm's collapsible section for times that go with the range, such as fades. Controlled with value and onValueChange, or seeded with defaultValue. Other props go to the input.

API reference

TimeRangeForm

A card for a span of time: start and end times typed as m:ss, with the length worked out large between them, for a sound loop, a clip trim, a meeting slot or a shift. The length shows a dash until both times read as times and the end comes after the start. Anything passed as children sits in a collapsible section under the range. Other props go to the Card.

Prop

Type

It also accepts the HTML attributes of the element it renders, and the props of the stock Card it builds on.

TimeField

A labelled text field for an m:ss time, in tabular mono figures. Use it inside TimeRangeForm's collapsible section for times that go with the range, such as fades. Controlled with value and onValueChange, or seeded with defaultValue. Other props go to the input.

Prop

Type

It also accepts the HTML attributes of the element it renders.

Dependencies

npm: @phosphor-icons/react, cn. The CLI installs them for you.

Requires these pieces. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:

The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.

Last updated on