Glowup
INPUTS · 42 / 89
ClockDial
ClockDial — a Material You inputs component for React Native and web.
󱀫
packages/ui/src/components/ClockDial.tsx
Live demo
12
01
02
03
04
05
06
07
08
09
10
11
00
13
14
15
16
17
18
19
20
21
22
23
Properties
2 controls
Unit
Hours
󰍝
24-hour clock
Usage
ClockDial.tsx
<ClockDial unit="hours" />
Variants
The states and shapes this component is meant to be used in.
Units
`unit` decides which value the face edits: the hand swings to it and the ring relabels. Both `hours` and `minutes` are always passed in — the unit only says which of the two a drag writes to, so the hand can point at 25 minutes while the caller still knows the hour is 9.
Editing hours
12
1
2
3
4
5
6
7
8
9
10
11
Editing minutes
00
05
10
15
20
25
30
35
40
45
50
55
Clock formats
The 12-hour face is a single ring of 1–12. `use24HourClock` adds an inner ring for 13–00 and the hand shortens to reach it, which is how the same dial covers a whole day without a second surface. `hours` is always 0–23 whichever face is showing.
12-hour · one ring
12
1
2
3
4
5
6
7
8
9
10
11
24-hour · hand on the inner ring
12
01
02
03
04
05
06
07
08
09
10
11
00
13
14
15
16
17
18
19
20
21
22
23
Granularity
The minute face labels only the multiples of five, but every minute in between stays selectable by angle — exactly like a real clock. A hand landing on an unlabelled minute shrinks its knob to a dot instead of covering a bare spot on the face.
Every minute · knob on :07
00
05
10
15
20
25
30
35
40
45
50
55
Snapped to 15 · knob on :30
00
05
10
15
20
25
30
35
40
45
50
55
Disabled times
`isTimeDisabled` is asked about a candidate, not about the current value: on the hour face it receives the hour being considered with the current minutes, on the minute face the current hour with the candidate minute. Refused values grey out and a drag onto them is ignored.
Office hours only
12
01
02
03
04
05
06
07
08
09
10
11
00
13
14
15
16
17
18
19
20
21
22
23
Quarter hours only
00
05
10
15
20
25
30
35
40
45
50
55
API reference
Generated from the library's TypeScript, so it cannot drift from the implementation.
Props
11 on ClockDialProps
Filter props
󰍉
hours
required
number
Current hour, always 0–23 regardless of the displayed clock format.
minutes
required
number
onChangeHours
required
(hours: number) => void
onChangeMinutes
required
(minutes: number) => void
unit
required
ClockUnit
isTimeDisabled
(hours: number, minutes: number) => boolean
Greys out and refuses values the caller does not allow.
minuteInterval
number
default: 1
Minute granularity the dial snaps to. Defaults to 1.
onUnitComplete
() => void
Fires when a press on the hour dial ends, to hand over to the minutes.
style
StyleProp<ViewStyle>
testID
string
use24HourClock
boolean
default: false
Renders two rings (1–12 outer, 13–00 inner) instead of one.