Calm motion: animations on this site only fade, with no movement
DurationInput
Time as h:mm:ss or 1h 30m, held in seconds
A field for a length of time: a run time, a timer, an estimate. People type it in the way they think of it, and the value is a number of seconds.
Basic
seconds: 5400 · try 1h 30m, 90s, or 1:15:00
v-modelis the duration in seconds, ornullwhen the field is empty or not a time.- It reads
1:30:00,1h 30m,90sand1.5h. Two colon parts are minutes and seconds. With:seconds="false"they are hours and minutes (1:30is 5400 seconds). - On blur, the text becomes one format:
h:mm:ss, orh:mmwithout seconds. Text that is not a time stays in the field and shows "Enter a time such as 1:30 or 1h 30m". Replace the text withlabels.invalid. minandmaxare in seconds. A value outside them moves to the nearest limit as you type.parseDurationandformatDurationare exported for use outside the field.
Usage
ts
import { BlessDurationInput } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
seconds | boolean | true | show and read seconds (`h:mm:ss`). Off gives `h:mm`. |
min | number | — | the smallest value, in seconds |
max | number | — | the largest value, in seconds |
labels | Partial<{ invalid: string; }> | — | |
modelValue | number | null | null | the duration in seconds, or `null` when the field is empty or unreadable |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: number | null] |