フォーム
Duration Input
Temporal.Duration を値に持つ時間入力。時・分(必要なら秒)の数値フィールドとステッパーで構成し、フォームにそのまま組み込めます。
ReactVueWeb Components
Storybook で見る プレイグラウンド
使用例
<DurationInput defaultValue={Temporal.Duration.from({ hours: 1, minutes: 30 })} onChange={setDur} />
<DurationInput withSeconds value={dur} onChange={setDur} disabled /> 設定できる項目
| 名前 | 型 | 既定値 | 説明 |
|---|---|---|---|
value | Temporal.Duration | null | — | Controlled value. `null` represents an empty / unset duration. |
defaultValue | Temporal.Duration | null | — | Initial value when uncontrolled. @default null |
onChange | (value: Temporal.Duration | null) => void | — | Called with the new `Temporal.Duration` (or `null` when all fields are empty). |
withSeconds | boolean | false | Show a seconds field in addition to hours and minutes. @default false |
disabled | boolean | false | Disable all fields. @default false |
size | 'sm' | 'md' | 'lg' | md | Control size. @default 'md' |
status | 'primary' | 'danger' | 'warning' | 'success' | 'info' | 'neutral' | — | Status modifier. |
name | string | — | Native `name` forwarded to a hidden serialization input. |
id | string | — | `id` applied to the wrapping group element. |
hoursLabel | string | Hours | Accessible label for the hours field. @default 'Hours' |
minutesLabel | string | Minutes | Accessible label for the minutes field. @default 'Minutes' |
secondsLabel | string | Seconds | Accessible label for the seconds field. @default 'Seconds' |
アクセシビリティ
- 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
- マウスがなくても、キーボードだけですべての操作ができます。
- いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
- 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。
どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。