Knit UI
GitHub

Playground

Loading playground…

false
Playground
<TimeControlsList
  min={0}
  max={23}
  step={1}
  reversed={false}
  maxHeight={200}
  size="sm"
/>

Examples

Default

The hours column with a selected value (revealed on open).

Loading example…

DefaultSourceStorybook

Stepped

A minutes column stepped by 5.

Loading example…

SteppedSourceStorybook

Reversed

Descending order.

Loading example…

ReversedSourceStorybook

Styled Slots

Per-slot styles sugar — recolour every control via the control slot.

Loading example…

Styled SlotsSourceStorybook

Am Pm

The two-cell am/pm variant shown in the 12h dropdown.

Loading example…

Am PmSourceStorybook

Sizes

Every size token.

Loading example…

SizesSourceStorybook

Props

PropTypeDefaultDescription
max requirednumber23Largest value in the column.
min requirednumber0Smallest value in the column.
onSelect required(value: number) => voidCalled with the pressed value.
reversed requiredboolean | undefinedfalseRender the column in descending order.
step requirednumber1Step between successive values.
value requirednumber | nullCurrently selected value, or `null`.
getControlProps((value: number) => Partial<TimeControlProps<number>>) | undefinedPasses props down to each `TimeControl`, keyed by value (wins over `styles.control`).
maxHeightnumber | undefined200Max column height in px before it scrolls.
scrollAreaPropsScrollAreaProps | undefinedProps forwarded to the underlying `ScrollArea` (wins over `styles.root`).
size systemCalendarSize | undefined
xxs · xs · sm · md · lg · xl · xxl
'sm'Label font size.
styles systemSlotStyles<TimeControlsListStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.

Style slots

Every part of TimeControlsList can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
columnstyles={{ column: { … } }}
controlstyles={{ control: { … } }}
rootstyles={{ root: { … } }}