Skip to content

Pickers

CircularTimePicker

Bit.BlazorUI

A BitCircularTimePicker picks a single time from an analog clock dial: an hour ring the pointer snaps to, then a minute ring and an optional second ring, with an AM/PM pair in 12-hour mode. It can be driven with a pointer or entirely from the keyboard, restricted to a range or a step, edited as text, laid out portrait or landscape, and rendered either inline or in a callout that becomes a sheet on small screens.

Styling

Cascading parameters, colors, icons, sizes, Style & Class and right-to-left pickers.

Cascading parameters

A form full of time pickers usually repeats the same handful of parameters on every one of them. BitParams takes them out of the markup: it cascades a BitCircularTimePickerParams down to every BitCircularTimePicker underneath it, however deeply nested. Every property of that class is nullable, so only the ones actually set travel; the rest are left alone.

Here the clock format, the minute step, the actions and the accent are set once for the whole group. A value written on a picker itself always wins - the cascade only fills in what the markup left alone - which is why the last one below keeps its own step and color:





The value and the open state are deliberately left out of BitCircularTimePickerParams: both are per-field state the picker assigns to itself, so a cascaded value would be written straight back over what the person just picked. StartingValue is the cascadable way to say where an empty picker begins. The event callbacks are not part of it either. A CalloutHtmlAttributes cascaded this way is merged with the picker's own, whose entries win where both name the same attribute.

Parameters is a list, so a single BitParams can carry the parameters of several component types at once - a BitCircularTimePickerParams next to a BitButtonParams, each one reaching only the components it belongs to.

Color

Color picks the theme color of the accent the dial is painted with - the toolbar, the hand, the pin and the selected number - with Primary as the default. The semantic colors tie the picker to what the time it sets means, while the Background, Foreground and Border families keep it legible on non-default surfaces.





















External Icons

The glyphs are not limited to the built-in icon font: Icon and CloseButtonIcon take a BitIconInfo - or a raw CSS class string - that can point at any icon library whose stylesheet is loaded. Use BitIconInfo.Fa(), BitIconInfo.Bi() or BitIconInfo.Css() to build one.

They take precedence over their built-in counterparts, IconName (Clock by default) and CloseButtonIconName (Cancel), when both are set, and an IconTemplate wins over both for the field's glyph. The stylesheet of the icon library is the page's to load; the picker only writes the classes. The close button only exists with ShowCloseButton, in the callout.


FontAwesome:







Bootstrap:





Size

Size scales the field, the label, the dial, its numbers and the toolbar together, so the picker lines up with the other controls of a form at whichever size they are: Small where the clock has to share a dense layout, Medium (the default) for forms, and Large where the picker is the point of the screen or aimed at touch. The two rings and the hand keep their proportions at every size.



Style & Class

Style and Class land on the root element, while Styles and Classes reach every named part of the picker on their own - the toolbar, the face, the numbers, the hand and its thumb - so the callout can be restyled without a single descendant selector. The parts are listed under BitCircularTimePickerClassStyles.

The callout is rendered beside the root rather than inside it, so Class does not reach it - style the dial through Classes.Callout and the other slots instead. Focused is applied to the root while the field or its open callout holds the focus. ClockSelectedNumber and ClockDisabledNumber are added to ClockNumber on the numbers in those states, and SelectedButtons to the toolbar part the dial is on and to the selected half of the AM/PM pair.


Component's Style & Class:





Styles & Classes:





CSS variables (listed under CSS variables on the API page) restyle the picker without a selector. On :root they re-skin every picker of the app. They restyle the default, not a choice: an explicit Color or Size wins over the variables for what it sets. The callout moves to the end of the body while it is open, yet it keeps inheriting from the picker's ancestors, so a wrapper around the picker reaches the field, the label, the icon and the dial alike:


Per instance, a variable on Style or Styles.Root reaches the field and the dial alike, and one on Styles.Callout the dial alone:

RTL

Dir flips the field, the label and the toolbar into a right-to-left layout, and reaches the callout as well even though it is rendered outside the root element. The dial itself keeps running clockwise, and the parts of the time in the toolbar stay in reading order, because a clock reads the same way in every script.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.