Crates.io | leptos_calendar |
lib.rs | leptos_calendar |
version | 0.1.1 |
source | src |
created_at | 2024-11-13 14:32:55.701009 |
updated_at | 2024-11-13 15:39:28.102758 |
description | A calendar component for leptos apps |
homepage | |
repository | |
max_upload_size | |
id | 1446570 |
size | 8,813 |
This component provides a calendar component and a configuration hook to be able to apply styles to it.
#[component]
fn Parent() -> into ImplView {
let calendar_config = CalendarConfig {
active_classes: Some("border-pink-400 border-2".to_string()),
header_classes: Some("bg-slate-900 text-white".to_string()),
month_classes: Some("bg-black p-3 text-center text-4xl font-normal".to_string()),
cell_classes: Some("bg-black text-center py-3 px-4 border aspect-square".to_string()),
..Default::default()
};
let (selected_date, _) = create_signal(
NaiveDate::from_ymd_opt(2025, 1, 30)
.and_then(|x| x.and_hms_opt(12, 12, 12))
.and_then(|x| Some(x.and_local_timezone(Local).unwrap()))
.unwrap(),
);
view! {
<CalendarRoot config=calendar_config>
<Calendar date=selected_date class="border-2 border-white bg-slate-50" />
</CalendarRoot>
}
}
cell_renderer
into a sub-component instead of config (if possible)This isn't super well tested, so if you use it and run into problems or rough edges, please file issues