DurationInput
Edits an ISO-8601 duration string via per-unit numeric inputs.
Installation
pnpm dlx shadcn@latest add @shadmin/duration-inputUsage
import { DurationInput } from '@/components/admin';
<DurationInput source="duration" />
<DurationInput source="duration" units={["h", "m"]} />
<DurationInput source="duration" disabled />Props
| Prop | Required | Type | Default | Description |
|---|---|---|---|---|
source | Required | string | - | Form field name |
units | Optional | ("d"|"h"|"m"|"s")[] | ["d","h","m","s"] | Which units to expose |
label | Optional | string | false | Inferred | Custom label |
helperText | Optional | ReactNode | - | Helper text |
disabled | Optional | boolean | false | Disable all unit inputs |
defaultValue | Optional | string | - | Initial ISO duration |
validate | Optional | Validator | Validator[] | - | Validation |
className | Optional | string | - | CSS class on wrapping <div> |
Storage format
ISO-8601 duration strings. An empty input writes null.