Components / YearView

YearView

The twelve months of a year, with marks on the days.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn year_view() -> impl View {
    let year = State::new(2026);
    let chosen = State::new(None::<Date>);
    YearView::new(year.binding())
        .selected(chosen.binding())
        .today(Date::new(2026, 11, 5).unwrap_or_else(|| Date::from_days(0)))
        .marks(|day| match day.day() % 11 {
            0 => Some(DayMark::new().tone(Tone::Accent).label("Shoot")),
            5 => Some(DayMark::new().tone(Tone::Success).label("Delivery")),
            _ => None,
        })
}

Open in the playground, with every example →

Full API of YearView →