Skip to main content

date_picker_year

Function date_picker_year 

Source
pub fn date_picker_year(year: i32) -> DatePickerYearBuilder
Expand description

§date_picker_year

Render an interactive year choice for calendars and year-selection controls.

§Usage

Arrange year choices in scheduling, date entry, and historical date selectors.

§Parameters

  • year, on_select — represented year and its activation callback.
  • selected, is_today, enabled — selection, current-year appearance, and availability.
  • presentation_state — optional appearance that preserves real interaction and focus.
  • modifier, focus_requester — layout, keyboard behavior, and external focus control.
  • label_formatter — optional visible year text; accessibility retains the actual year.
  • accessibility_label, accessibility_description — optional spoken year information.

§Examples

use tessera_components::{date_picker::date_picker_year, theme::material_theme};
use tessera_ui::{remember, tessera};
#[tessera]
fn years() {
    material_theme().child(|| {
        let selected = remember(|| 2025);
        date_picker_year(2026)
            .selected(selected.get() == 2026)
            .on_select(move |year| selected.set(year));
        assert_eq!(selected.get(), 2025);
    });
}