use_calendar
Create bare-bone calendar data to use in your component.
See UseCalendarOptions
for options and UseCalendarReturn
for return values.
Demo
Usage
use leptos::prelude::*;
use leptos_use::{use_calendar, UseCalendarReturn};
#[component]
fn Demo() -> impl IntoView {
let UseCalendarReturn {
dates,
weekdays,
previous_month,
today,
next_month
} = use_calendar();
view! {
}
}
Use use_calendar_with_options
to change the initial date and first day of the week.
use leptos::prelude::*;
use chrono::NaiveDate;
use leptos_use::{use_calendar_with_options, UseCalendarReturn, UseCalendarOptions};
#[component]
fn Demo() -> impl IntoView {
let initial_date = RwSignal::new(
Some(NaiveDate::from_ymd_opt(2022, 1, 1).unwrap())
);
let options = UseCalendarOptions::default()
.first_day_of_the_week(6)
.initial_date(initial_date);
let UseCalendarReturn {
dates,
weekdays,
previous_month,
today,
next_month
} = use_calendar_with_options(options);
view! {
}
}
Server-Side Rendering
Not tested yet.
Feature
This function is only available if the crate feature
use_calendar
is enabled