v7.3.0

YearPicker
Widget

A panel that displays a grid of 12 years and lets the user pick one. Navigate between year ranges using the built-in previous/next buttons in the toolbar. The startYear config sets the first year of the displayed range, and the year property reflects the current selection. The select event fires when the user picks a year.

const yearPicker = new YearPicker({
    year     : 2025,
    appendTo : document.body,
    onSelect({ value }) {
        console.log('Selected year:', value);
    }
});

Useful configs and events

Config / Event Description
startYear First year displayed in the 12-year range
year The initially selected year
tbar Top toolbar with navigation buttons and title
select Fired when a year is selected

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • The highest year to allow.

  • The lowest year to allow.

  • The year to show at the start of the widget

    Has a corresponding runtime startYear property.

  • The year to use as the selected year. Defaults to the current year.

    Has a corresponding runtime year property.

Properties

Properties are getters/setters or publicly accessible variables on this class

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class

CSS variables

CSS variables that can be set to adjust appearance
Name Description
--b-year-picker-gap Gap between the years in the year picker, and months in the month picker.
--b-year-picker-padding Padding inside the year picker and the month picker.
--b-year-picker-title-font-weight Font weight for the title of the year picker and the month picker
--b-year-picker-year-color Color for the years in the year picker and the months in the month picker
--b-year-picker-year-font-weight Font weight for the years in the year picker and the months in the month picker
Hovered
--b-year-picker-hover-background Background for the hovered year in the year picker and the hovered month in the month picker
Selected
--b-year-picker-selected-background Background for the selected year in the year picker and the selected month in the month picker
--b-year-picker-selected-color Color for the selected year in the year picker and the selected month in the month picker
type: yearpicker

Source path

Core/widget/YearPicker.js

Contents