Blocks / Duration input

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";
/01 → Presets
h
min
import { DurationInput } from "@forgeron/ui";

export default function Presets() {
  return <DurationInput label="Duration" defaultValue={90} />;
}
API → Props
PropTypeDefaultDescription
labelstring—Names the field.
value / defaultValuenumber | null—Minutes. Controlled or not.
onChange(minutes: number | null) => void—On every edit or preset.
presetsnumber[][15, 30, 45, 60, 90, 120]The buttons; [] for none.
min / max / stepnumber0 / 1440 / 5Limits in minutes, and the step of the arrows on the minutes.
disabledboolean—Read only.
classNamestring—Extra classes.