A shadcn calendar. The month grid is rendered client-side from the seed
attributes. input$<inputId> is a Date (single) or length-2 Date
(range), via the shadshiny.date input handler.
Arguments
- inputId
Input id.
- value
Initial selection: a
Date/character (single) or length-2Date/character (range).- mode
"single"(default) or"range".- min, max
Selectable bounds (inclusive),
Date/character.- month
Initially displayed month (
Dateor"YYYY-MM"). Sets the month the grid opens on without selecting anything.- caption_layout
Header style:
"label"(default, month and year as text),"dropdown"(both as selects),"dropdown-months"or"dropdown-years". Use a dropdown when the user has to travel years, such as a date of birth.- year_range
Length-2 numeric bounding the year dropdown, e.g.
c(1900, 2025). Defaults to the years ofmin/maxwhen given, otherwise 100 years back and 10 forward.- week_starts_on
0(Sunday, default) or1(Monday).- disabled
If
TRUE, disables the control.- class
Extra CSS classes.
- ...
Extra attributes on the calendar root.
See also
Other shadshiny tier-2 components:
shad_checkbox(),
shad_combobox(),
shad_date_picker(),
shad_date_presets(),
shad_form_field(),
shad_input(),
shad_input_group(),
shad_input_otp(),
shad_native_select(),
shad_radio_group(),
shad_select(),
shad_slider(),
shad_switch(),
shad_textarea(),
shad_toggle(),
shad_toggle_group()
Examples
shad_calendar("day", value = Sys.Date())
#> <div class="shad-calendar" data-shad="calendar" id="day" data-mode="single" data-value="2026-11-09" data-week-start="0"></div>
shad_calendar("range", mode = "range", week_starts_on = 1)
#> <div class="shad-calendar" data-shad="calendar" id="range" data-mode="range" data-week-start="1"></div>
shad_calendar("dob", caption_layout = "dropdown", year_range = c(1900, 2025))
#> <div class="shad-calendar" data-shad="calendar" id="dob" data-mode="single" data-week-start="0" data-caption-layout="dropdown" data-from-year="1900" data-to-year="2025"></div>