Duration input
Hours and minutes (75 minutes becomes 1 h 15) and the usual lengths as one-click presets.
import { DurationInput, formatMinutes, parseMinutes } from "@forgeron/ui";import { DurationInput } from "@forgeron/ui";
export default function Presets() {
return <DurationInput label="Duration" defaultValue={90} />;
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Names the field. |
value / defaultValue | number | null | — | Minutes. Controlled or not. |
onChange | (minutes: number | null) => void | — | On every edit or preset. |
presets | number[] | [15, 30, 45, 60, 90, 120] | The buttons; [] for none. |
min / max / step | number | 0 / 1440 / 5 | Limits in minutes, and the step of the arrows on the minutes. |
disabled | boolean | — | Read only. |
className | string | — | Extra classes. |