Skip to content

Wheel Picker

The WheelPicker component provides a wheel-based selection mechanism that allows users to scroll through a list of options. It is primarily used as a dependency for other components like DatePicker and TimePicker.

The WheelPicker is typically not used directly but is integrated into other components like DatePicker and TimePicker. These components extend the WheelPicker’s functionality by adding specific implementation for date and time selection.

The WheelPicker has the following HTML structure:

<div class="wheel-picker">
<div class="select-wrapper">
<div class="select-block">
<ul>
<!-- Options go here -->
<li>Option 1</li>
<li class="active">Option 2</li>
<li>Option 3</li>
</ul>
</div>
<div class="action-block">
<!-- Action buttons go here -->
</div>
</div>
</div>

While the WheelPicker itself doesn’t have direct plugin parameters, components that use it (like DatePicker and TimePicker) implement parameters such as:

ParameterTypeDefaultDescription
distancenumber3The number of items visible above and below the selected item
scrollSpeednumber4The speed of scrolling when dragging
openModestring”auto”How the picker opens. Options: “auto”, “up”, “dialog”

Components that use WheelPicker typically implement the following methods:

  • open() - Opens the wheel picker dropdown
  • close() - Closes the wheel picker dropdown

Components that use WheelPicker typically implement the following events:

EventDescription
onOpenTriggered when the picker is opened
onCloseTriggered when the picker is closed
onScrollTriggered when scrolling through options

The WheelPicker component can be styled using the following CSS variables:

VariableDefault (Light)Dark ModeDescription
--wheel-picker-border-radius4px4pxBorder radius for the wheel picker
--wheel-picker-color#191919#dbdfe7Text color for the wheel picker options
--wheel-picker-selected-backgroundrgba(175, 175, 175, 0.5)rgba(78, 81, 88, 0.5)Background color for the selected option
--picker-heightvar(—control-height, 36px)var(—control-height, 36px)Height of the picker
--picker-font-size16px16pxFont size of the picker options
.my-custom-picker {
--wheel-picker-border-radius: 6px;
--wheel-picker-color: #333;
--wheel-picker-selected-background: rgba(0, 123, 255, 0.3);
--picker-height: 42px;
--picker-font-size: 18px;
}
  • .wheel-picker - The main container class
  • .select-wrapper - Container for the selection dropdown
  • .select-block - Container for the selection lists
  • .action-block - Container for action buttons
  • .small - Small size picker (height: var(—control-height-small), font-size: 12px)
  • .medium - Medium size picker (height: var(—control-height-medium), font-size: 14px)
  • .large - Large size picker (height: var(—control-height-large), font-size: 20px)
  • .drop-up-select - Positions the dropdown above the input
  • .drop-as-dialog - Displays the picker as a dialog

The WheelPicker is used by the following components:

<input data-role="date-picker" data-label="Select date">
<input data-role="time-picker" data-label="Select time">

The WheelPicker is primarily a CSS component that provides the visual structure and styling for wheel-based selection. The actual functionality (scrolling, selection, etc.) is implemented by the components that use it, such as DatePicker and TimePicker.