Calendar
A compact month view for one date: months slide the way you travel, the selection moves between days and arrows skip blocked days.
oxyn add calendarrsx! {
Calendar {
value: Some(day()),
today: today_iso(),
week_starts_on: 0,
show_today: true,
on_change: move |iso: String| day.set(iso),
}
}Rendered from Rust at build time · goes live when visible
When to use
- A compact month view to pick one date: a due date, a run schedule, a checkpoint day.
- Also the grid inside the date picker and the range picker.
When not to use
- A field that opens the calendar in a popover: use Date picker instead.
- Presets and two months with a hover preview after the first click, comparison with the previous period or year, Apply and Cancel: use Date Range Picker instead.
- iOS-style wheels for day and time: use Date wheel instead.
Installation
Calendar is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add calendaruse crate::oxyn::{Calendar, PRIMITIVES_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{Calendar, PRIMITIVES_CSS};
Usage
rsx! {
Calendar {
value: Some(day()),
today: today_iso(),
week_starts_on: 0,
show_today: true,
on_change: move |iso: String| day.set(iso),
}
}Examples
Default
One date with a Today button.
Code
rsx! {
Calendar {
value: Some(day()),
today: today_iso(),
week_starts_on: 0,
show_today: true,
on_change: move |iso: String| day.set(iso),
}
}Weekdays
Weekends blocked, Monday first.
Code
rsx! {
Calendar {
value: Some(day()),
today: today_iso(),
blocked: "weekends",
week_starts_on: 1,
show_today: true,
on_change: move |iso: String| day.set(iso),
}
}Bounded
Min and max.
Code
rsx! {
Calendar {
value: Some(day()),
today: today_iso(),
week_starts_on: 0,
show_today: true,
on_change: move |iso: String| day.set(iso),
}
}Heat
Run history per day (Oxyn plus).
Code
rsx! {
Calendar {
value: Some(day()),
today: today_iso(),
week_starts_on: 0,
show_today: true,
week_numbers: true,
on_change: move |iso: String| day.set(iso),
}
}API reference
Calendar
| Prop | Type | Default | Description |
|---|---|---|---|
value | Option<String> | Default::default() | Picked date (ISO). |
today | String | "2026-11-13" | Today (ISO); pass it so server and client agree. |
min | Option<String> | Default::default() | Earliest day (ISO). |
max | Option<String> | Default::default() | Latest day (ISO). |
blocked | String | "none" | `none` · `weekends`. |
week_starts_on | u8 | Default::default() | 0 = Sunday, 1 = Monday. |
show_today | bool | Default::default() | Today button. |
week_numbers | bool | Default::default() | Oxyn plus: ISO week numbers. |
activity | Vec<(String, u8)> | Default::default() | Oxyn plus: activity per day `(ISO, 0–4)`. |
label | String | "Calendar" | Accessible name. |
on_change | EventHandler<String> | — | Picked. |
on_month_change | EventHandler<String> | — | Month changed (first of the month, ISO). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Arrow keys | One day or one week, skipping blocked days and crossing months |
| HomeorEnd | Start / end of the week |
| Page UporPage Down | A month (Shift: a year) |
| EnterorSpace | Pick the focused day |
Accessibility
- Days sit in a role=grid; each day is a gridcell button with its full date as its name, aria-selected and aria-current=date for today.
- One tab stop (aria-activedescendant); the month title is announced when it changes.
- Pagers are labelled and aria-disabled at min or max.
From the spec
One focusable role=grid with aria-activedescendant (a single tab stop); weekday headers are columnheaders with full names. The month title is a polite live region. Pagers are labelled and aria-disabled at bounds. Keys follow the APG date-grid pattern.
Motion & interaction
Months slide in from the side you're travelling to (later → from the right). The title rolls. The selection moves between days on a snap. The Today button jumps and slides like a page.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Month slide | 240 ms, 20 px | ease.out | 1 ms |
| Title roll | 220 ms | ease.out | swap |
| Selection | 214 ms spring.snap colour | spring | instant |
| Hover | 120 ms | ease.out | 80 ms |
Responsive behaviour
- min(100%, 328 px) wide; days are square cells that scale.
- Below 260 px the title takes its own row.
Edge cases (spec)
Leap years and month ends (31 Jan + 1 month = 28/29 Feb). A value outside min / max shows but can't be re-picked. Six-row months keep the grid height steady. Narrow containers (< 260 px): the title takes its own row. Tiny panels: cells stay square and scale. RTL: the grid mirrors, ← moves to the next day visually.
Notes for AI
- Import
Calendarfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
CalendarElinoxyn_gpui. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.