Date picker
A date picker takes a date that users type or pick from a calendar. On a Thai page it shows the Buddhist era (พ.ศ.); your code always gets an ISO date in the Gregorian year.
Installation
npm gives you every component from the package. shadcn copies the source into your app instead: a copy pinned to this version that you can change. The shadcn commands need the @kanok-ui registry in your components.json once, see Installation.
Use it
UiDatePicker fires a native change, so its React prop is onChange (there is no onUiChange). The Tailwind DatePicker hands onChange the ISO string itself.
What users see, what you get
Users see and type the date in the page's language and era. Your code reads the same ISO date in every language. The two pickers below share one value: change either one.
value:
| Page in Thai | Page in English | |
|---|---|---|
| The user sees and types | 10/10/2569 | 10/10/2026 |
value, change, the submitted form |
2026-10-10 |
2026-10-10 |
value,minandmaxare alwaysyyyy-mm-ddin the Gregorian year. Avaluethat isn't a real date of that form becomes'', as with<input type="date">.- The element fires
changewhen a value is committed: on leaving the field, on Enter, on a pick from the calendar and on clear. Readevent.target.value(andendValuein a range). - An empty field still submits
name=, as a native date input does. A disabled picker submits nothing.
Type it or pick it
The calendar opens when the text box gets focus, by a click or by Tab, and focus stays in the box so users can keep typing. The calendar follows what they type.
- Text that already reads as a full date in the field's format, such as
10/10/2026, becomes the value at once;changefires when it is committed (blur, Enter), not while typing. - Anything else is read on blur or Enter. The numbers are pulled out of what was typed, so
s10/12/2026xbecomes 10/12/2026. - Nothing is guessed. An incomplete date (
10/12), an impossible one (31/04/2026) or text with no date in it stays in the field with a message saying what's wrong, andvaluebecomes''. - A full date outside
min/max, or oneisDateDisabledrefuses, is kept and committed with its own message. The form won't submit until it's fixed.
Try it: type a date that doesn't exist, or one outside the year, then leave the field.
The messages come built in, in Thai and English. How and when errors show, and how to add your own, is in Forms and validation.
Buddhist era and Thai
The language comes from lang on the element or the closest ancestor, else <html lang>. A Thai language gives Thai labels and messages, Thai month names, and years in พ.ศ. (ค.ศ. + 543). locale overrides the language for this picker alone.
erasets the year users see and type:be(พ.ศ., the default for Thai) orce(ค.ศ., the default otherwise). Any language can use either.- Typed years follow the same era. In พ.ศ., a year before 2400 (say 2026) gets a message asking for the พ.ศ. year; nothing is converted behind the user's back.
- Users may type Thai digits (๐–๙). They become 0–9 as they type.
- The placeholder and the default helper line show the format in the page's language:
วว/ดด/ปปปปin Thai. - React + Tailwind reads
<html lang>, or itslocaleprop.
Formats
format sets the order of day, month and year: dd/mm/yyyy (the default), mm/dd/yyyy or yyyy-mm-dd. Only what users see changes; value stays ISO.
The format shows as helper text until you set helper-text (helperText in React + Tailwind). Screen readers still hear it after that.
Pick a range
range gives two fields sharing one calendar: value / name / label for the start, end-value / end-name / end-label for the end. With both names the form gets two entries. Without end-name, ui-date-picker submits one name entry, start/end (2026-10-01/2026-10-05), as Carbon's cds-date-picker does; the React + Tailwind DatePicker submits the end only under endName.
- A pick keeps the calendar open for the end. The days in between are highlighted with a continuous ribbon, with a preview on either side of the start while the end is chosen (from the pointer or the keys; a day that can't be picked doesn't move it).
- Picking an end before the start swaps the two.
- With a whole range chosen, the next pick starts a new range (as Cally);
changefires once both ends are picked. - A typed end before the start is kept and reported, not swapped.
Two-month range view
Set months="2" to display two side-by-side months in the calendar, ideal for flight/hotel booking and long booking ranges:
Limit the dates
min and max take ISO dates. Days outside them are greyed out, and the month buttons stop at them.
To refuse single days (weekends, holidays), set isDateDisabled: a function that returns true, or a string to show as the message. On the web component it's a property, so set it in JavaScript:
Clear button and Today
clearable adds a × inside the field while it has text. show-today adds a Today button under the calendar (Carbon has none; this one is opt-in). first-day sets the first day of the week, from 0 (Sunday, the default) to 6.
Sizes and fluid
size: sm 32px, md 40px (the default, as in Carbon), lg 48px, the same scale as the text input. fluid, or a fluid form around it (<ui-fluid-form>, FluidForm in React + Tailwind), gives Carbon's fluid field: a 64px box with the label inside. Both props have the same names in React and React + Tailwind.
Outlined (Kanok design)
In the Kanok design, fields are filled by default: a soft grey fill, no edge. Put data-field-variant="outlined" on an element around the field (a <form>, or <html> for the whole app) for a 1px edge on no fill; focus is still the soft blue halo. The attribute does nothing in the Carbon design, so the example below sits inside data-design="kanok". See Kanok design for the details.
Helper text, errors and warnings
helper-text says what the date is for (the helper-text slot takes markup). warn with warn-text flags a date that is allowed but unusual; it doesn't block submit. invalid with invalid-text shows an error from your own check, such as one made on the server. In a range, the warning shows under the start field.
Read-only and disabled
readonly shows and submits the value but blocks typing and the calendar. disabled greys the field out; it isn't submitted or validated. A disabled <fieldset> around it does the same.
The web component and its React wrapper spell it readonly; React + Tailwind uses readOnly.
In a form
With required, the form won't submit until the date is filled in; in a range, both dates are required. The form gets ISO dates under name (and end-name). Submit the empty form below to see the messages.
Submitted:
send stands for your own code.
Phones and tablets
On a phone (a touch screen narrower than 42rem), picker="auto" (the default) opens the calendar in a bottom sheet: a dialog along the bottom edge of the screen, over a dimmed page.
- A tap on the box opens it with a day focused, so no on-screen keyboard comes up over it. Focus alone doesn't open it: after the sheet closes, a tap on the box types.
- Esc, the × button, a swipe down on its top bar or a tap on the dimmed page closes it. Typed text is committed and focus goes back to the box.
- While it is open the page behind can't be reached or scrolled, and the sheet's padding keeps clear of the phone's safe areas (the home indicator, a notch).
On tablets and larger screens the calendar opens under the box as before.
picker |
Opens |
|---|---|
auto (default) |
The bottom sheet on a phone, the calendar under the box everywhere else |
custom |
The calendar under the box on every device |
sheet |
The bottom sheet on every device |
native |
The OS date picker. It can't grey out isDateDisabled days, so its pick is checked like typed text |
Style the sheet with ::part(sheet) (its scrim with ::part(sheet)::backdrop), ::part(sheet-grip) and ::part(sheet-close); --ui-sheet-radius rounds its top corners (the menu radius by default). The prop has the same name in every variant.
The calendar on its own
The calendar inside the picker is its own element, ui-calendar, and it comes with the same import. It is a controlled view: it moves its own focus, but you keep the chosen day. Listen to ui-pick (detail { date }, a Date) and set value:
The month shown follows the focusDate property (a Date, today by default). Like the picker, ui-calendar follows the page's language (the nearest lang) and shows พ.ศ. in Thai; locale and era override it. It takes min, max, isDateDisabled, range with end-value, first-day and show-today as the picker does. The React + Tailwind Calendar is controlled too: focusDate, onFocusDateChange and onPick are required.
Multiple dates (multi)
<ui-calendar multi> allows selecting multiple arbitrary dates simultaneously (Cally style), toggled into values:
Dual-month calendar (months="2")
<ui-calendar range months="2"> renders two months side-by-side with a continuous cross-month range ribbon:
Month and year selects (as Cally)
The calendar's header has Cally's two native selects, <ui-calendar-select-month> and <ui-calendar-select-year>. A month wholly outside min / max is off, and the year list holds 20 years around the year shown, cut to min / max. On a Thai page the years are in พ.ศ. With several months the header has the year select only, because each grid has its month's name.
Put your own content in the heading slot to replace them. Selects you put there, or inside what you put there, follow the calendar too:
| Element | Attribute | Does |
|---|---|---|
ui-calendar-select-month |
format-month |
Month names long (default) or short |
ui-calendar-select-year |
max-years |
How many years to offer around the year shown (default 20) |
Style the selects with ui-calendar::part(month-select) and ::part(year-select). The React + Tailwind Calendar has the same header; the headless parts are Calendar.MonthSelect and Calendar.YearSelect.
More calendar options (as Cally)
ui-calendar / ui-date-picker |
React + Tailwind | Does |
|---|---|---|
months |
months |
1 to 12 months side by side; 12 months show the calendar year from January |
page-by="single" |
pageBy="single" |
‹ › move several months by one month (default: a whole page) |
show-week-numbers |
showWeekNumbers |
An ISO week number before each week; the picker's popover widens for it |
show-outside-days |
showOutsideDays |
Shows other months' days, in six weeks. By default they are blank and only the weeks the month needs show, as Cally (one month only) |
weekday-format |
weekdayFormat |
Weekday headings narrow or short (default: the translation's) |
today |
today |
The day marked as today, ISO; handy for tests and screenshots |
getDayParts (property, ui-calendar only) |
dayClassName |
Your own part names / classes for a day: holidays, events |
Style the parts that getDayParts returns with ::part():
ui-calendar also fires these events:
ui-range-startandui-range-end(detail{ date }) for each end of a range.changewaits until both ends are picked.ui-page-change(detail{ start, end }) when the months on show change. The React + TailwindCalendarhasonPageChangefor this.
Other options:
focus({ target: 'previous' | 'next' | 'day' })moves focus to an arrow button or to the day.- The
previousandnextslots replace the arrow icons, andheadingthe month and year selects. <ui-date-picker>takesshow-outside-days,getDayParts(it exports the part names it returns, soui-date-picker::part(holiday)works) and firesui-range-start/ui-range-end; the React + TailwindDatePickerhasonRangeStart/onRangeEnd.- Every day button has a part for each state it is in:
selected,today,outside,disabled,disallowed,range-start,range-end,in-rangeandday-0…day-6. The week numbers have the partweeknumber. - In a right-to-left page, ← and → swap.
Skeleton
While the page loads its data, show <ui-date-picker-skeleton> in the picker's place, as Carbon's DatePickerSkeleton; add range for two fields. It has its own import, @purpurabog/ui/date-picker-skeleton, and is hidden from screen readers.
Keyboard
In the text box:
| Key | Does |
|---|---|
| Typing | Enters the date; the open calendar follows a full date |
| ↓ | Opens the calendar and moves focus into it |
| Tab | Moves on to the next field (in a range, from the start to the end); what was typed is committed and the calendar closes once focus leaves the picker |
| Shift + Tab | From the start field: closes the calendar and moves back |
| Enter | Commits the typed text, closes the calendar and submits the form it's in |
| Esc | Closes the calendar |
In the calendar:
| Key | Does |
|---|---|
| ← / → | Previous / next day |
| ↑ / ↓ | Same day of the previous / next week |
| Home / End | First / last day of the week |
| Page Up / Page Down | Previous / next month |
| Shift + Page Up / Page Down | Previous / next year |
| Enter, Space | Picks the day; the calendar closes (in a range, after the end) |
| Esc | Closes, focus back in the text box |
| Tab | Goes round the calendar's own controls: ‹, the month, the year, ›, the day (and Today), back to the first after the last; Esc or a pick leaves the calendar |
| Shift + Tab | The same, the other way round |
With a mouse, pick a month or a year from the selects in the calendar header.
Accessibility
- The text box is a combobox that opens a dialog (
aria-haspopup="dialog",aria-expanded). The calendar is a dialog named "Choose date" with a grid of day buttons, following the WAI-ARIA date picker dialog pattern. - Each day is read as a full date ("Saturday, October 10, 2026"). Today has
aria-current="date", chosen daysaria-pressed, refused daysaria-disabled. - Month changes are announced through a polite live region.
- The bottom sheet is a modal dialog with the same name: the page behind it is inert until it closes.
- The calendar icon is decorative, as in Carbon: it is not a Tab stop, and a click on it is a click in the text box.
- An error sets
aria-invalidand is linked to the box witharia-describedby, as is the format hint.
Unstyled React parts with the same behaviour: Headless Date picker.
API
Generated from the package. In React, pass a property as a prop of the same name; events are props too (the React column).
<ui-date-picker> · React UiDatePicker
Attributes
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
label |
label |
string |
'' |
Visible label text; the label slot replaces it when markup is needed. |
hide-label |
hideLabel |
boolean |
false |
Keep the label for screen readers but don't show it. |
helper-text |
helperText |
string |
'' |
Helper text under the field, shown while there is no error or warning. |
invalid-text |
invalidText |
string |
'' |
Error text shown while invalid or while the field fails validation. |
invalid |
invalid |
boolean |
false |
Forces the error state, e.g. after server-side validation. |
warn |
warn |
boolean |
false |
Non-blocking warning; shown when there is no error. |
warn-text |
warnText |
string |
'' |
Text of the warning shown while warn. |
value |
value |
string |
'' |
ISO yyyy-mm-dd (the start date in range mode). |
name |
name |
string |
'' |
Reflected: form-associated elements submit under the name attribute. |
range |
range |
boolean |
false |
Two fields sharing one calendar (Carbon datePickerType="range"). |
end-value |
endValue |
string |
'' |
Range mode: the end date, ISO yyyy-mm-dd. |
end-name |
endName |
string |
'' |
Range mode: form entry name of the end date. Without it the range submits as one name entry start/end. |
end-label |
endLabel |
string |
'' |
Range mode: label of the end field. |
min |
min |
string |
'' |
Earliest selectable date, ISO yyyy-mm-dd. |
max |
max |
string |
'' |
Latest selectable date, ISO yyyy-mm-dd. |
format |
format |
DateFormat |
'dd/mm/yyyy' |
|
locale |
locale |
string |
'' |
Locale for names, labels and messages. Defaults to the nearest lang: the element's own, an ancestor's, then <html>'s, else the browser language. |
era |
era |
Era | '' |
'' |
Year era shown and typed: be (พ.ศ.) or ce (ค.ศ.). Defaults to be for Thai locales. |
first-day |
firstDay |
number |
0 |
0 = Sunday … 6 = Saturday. |
disabled |
disabled |
boolean |
false |
Disables the control; a disabled <fieldset> ancestor does the same. |
required |
required |
boolean |
false |
Blocks form submission while the field is empty. |
readonly |
readonly |
boolean |
false |
Shows and submits the value but blocks changes. |
fluid |
fluid |
boolean |
false |
Carbon FluidDatePicker: each date box is a 64px box with its label inside. <ui-fluid-form> sets it for every field inside. |
picker |
picker |
'auto' | 'custom' | 'sheet' | 'native' |
'auto' |
Which picker opens: auto (default) = our calendar, in a bottom sheet on a phone; custom = our calendar as a popover on every device; sheet = in a bottom sheet on every device; native = the OS date picker. |
clearable |
clearable |
boolean |
false |
Shows a clear button inside the field while it has text. |
show-today |
showToday |
boolean |
false |
Adds a "Today" button under the calendar. |
months |
months |
number |
1 |
Months to show side by side in the calendar, 1 to 12 (default 1, e.g. 2 for range picking). |
page-by |
pageBy |
'months' | 'single' |
'months' |
With more than one month, ‹ › turn a whole page (months) or one month (single): the calendar's page-by. |
show-outside-days |
showOutsideDays |
boolean |
false |
Show the days of the months before and after (by default they are blank): the calendar's show-outside-days. |
show-week-numbers |
showWeekNumbers |
boolean |
false |
A column of ISO week numbers in the calendar: its show-week-numbers. |
weekday-format |
weekdayFormat |
'narrow' | 'short' | '' |
'' |
Weekday headings narrow or short: the calendar's weekday-format. |
today |
today |
string |
'' |
The day the calendar marks as today, ISO (default the real today). |
size |
size |
'sm' | 'md' | 'lg' |
'md' |
Field height, same scale as ui-text-input. |
Properties
| Property | Type | Description |
|---|---|---|
getDayParts |
(date: Date) => string | undefined |
Extra part names for a calendar day, e.g. holiday: the calendar's getDayParts; the picker exports each name it returns, so ui-date-picker::part(holiday) styles those days. |
isDateDisabled |
(date: Date) => boolean | string | undefined |
Property only. Return true for days that can't be chosen (weekends, holidays…), or a string to show that reason instead of the generic message. |
willValidate |
(read-only) Whether the field takes part in constraint validation (not while disabled), as natively. | |
labels |
(read-only) The <label>s that point at this field. |
Methods
| Method | Description |
|---|---|
setCustomValidity(message) |
Like <input>.setCustomValidity(): a non-empty message makes the field invalid (and is shown as its error once touched) until cleared with ''. |
Events
| Event | React | Description |
|---|---|---|
change |
onChange |
When a committed value (start or end) changes: blur, Enter, a calendar pick or clear. |
ui-range-start |
onUiRangeStart |
Detail { date }, range: a calendar pick began a range (its start), as Cally's rangestart; change waits for the end |
ui-range-end |
onUiRangeEnd |
Detail { date }, range: a calendar pick finished a range (its end), as Cally's rangeend A typed date outside min/max is still committed, with the field reporting the range error. |
Slots
| Slot | Description |
|---|---|
label |
Label content with markup; the label attribute is the plain-text fallback |
helper-text |
Helper text with markup (links, bold); overrides helper-text |
warn-text |
Warning text shown while warn; overrides warn-text |
invalid-text |
Error text shown while invalid; overrides invalid-text |
end-label |
Label of the end field in range mode; overrides end-label |
CSS parts
| Part | Description |
|---|---|
base |
The field box (range: also start-base / end-base; same for every field part) |
label |
The label |
input |
The text box |
clear-button |
The × button |
toggle |
The calendar icon (decorative, as Carbon) |
status-icon |
The error / warning icon |
helper-text |
The helper line |
warning-text |
The warning line |
warn-text |
Same line as warning-text (named after the warn-text attribute / slot) |
error-text |
The error line |
invalid-text |
Same line as error-text (named after the invalid-text attribute / slot) |
calendar |
The popover shell (in the bottom sheet: the sheet's panel) |
sheet |
The bottom sheet <dialog> on a phone (picker="auto" / sheet; style its scrim with ::part(sheet)::backdrop) |
sheet-grip |
The sheet's top bar, which a swipe down closes |
sheet-close |
The sheet's × button |
header |
Calendar month / year row |
nav |
Previous / next month buttons |
heading |
The month and year selects' row |
month-select |
The month select (<ui-calendar-select-month>'s select) |
year-select |
The year select (<ui-calendar-select-year>'s select) |
month-title |
A month's name over its grid when several show |
grid |
The table of days |
day |
Each day button (its state also: selected, today, outside, disabled, disallowed, range-start, range-end, in-range, and the names getDayParts returns) |
weeknumber |
A week-number cell (show-week-numbers) |
today-button |
The optional "Today" button |
CSS custom properties
| Custom property | Default | Description |
|---|---|---|
--ui-field-border |
Border on every side of the box (default none: Carbon's underline only; Kanok: a 1px outline) | |
--ui-field-disabled-border-color |
Border colour when disabled (default: the underline transparent) | |
--ui-field-readonly-border-color |
Border colour when read-only (default: a hairline underline) | |
--ui-field-radius |
Corner radius of the box (default 0; Kanok: 6px) | |
--ui-field-background |
Fill of the box (default --ui-surface-1; Kanok: transparent) |
|
--ui-label-font |
Font of the label (default --ui-font-caption; Kanok: 14px semibold) |
|
--ui-label-color |
Colour of the label (default --ui-ink-muted; Kanok: --ui-ink) |
|
--ui-menu-radius |
/ --ui-menu-border / --ui-menu-shadow - Corners, border and shadow of the calendar (the menu settings) | |
--ui-sheet-radius |
The bottom sheet's top corners (default: the menu radius) | |
--ui-modal-scrim |
The bottom sheet's scrim, as the modal's (default Carbon's overlay) | |
--ui-calendar-day-radius |
Corner radius of a day (default 0; Kanok: 6px) | |
--ui-calendar-today-dot-radius |
Corner radius of today's dot (default 0, a square; Kanok: 50%, a dot) | |
--ui-field-readonly-background |
The box's fill when read-only (default transparent; Kanok: a faint ink tint, so read-only reads as set and never weaker than disabled) | |
--ui-fluid-background |
/ --ui-fluid-gap - A fluid box's fill and the space under it (default the layer's fill, 0: boxes that touch; Kanok: transparent, 8px) | |
--ui-icon-control-radius |
Corners of its small icon buttons, their hover fill and ring (default 0; Kanok: round) | |
--ui-focus-offset |
outline-offset of the month arrows' and Today's focus ring (default -2px: inside; Kanok: 2px outside) |
<ui-calendar> · React UiCalendar
Attributes
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
value |
value |
string |
'' |
Chosen day (start day in range mode), ISO yyyy-mm-dd. |
end-value |
endValue |
string |
'' |
Range mode: chosen end day, ISO yyyy-mm-dd. |
range |
range |
boolean |
false |
Whether range selection is enabled. |
multi |
multi |
boolean |
false |
Multi-date selection mode: select multiple individual dates (like Cally's calendar-multi). |
values |
values |
string[] | string |
[] |
Selected dates in multi mode (array or comma/space-separated ISO string). |
months |
months |
number |
1 |
Months on show side by side, 1 to 12 (default 1; 12 paged by the page is a calendar year, from January). |
page-by |
pageBy |
'months' | 'single' |
'months' |
With more than one month, ‹ › and the keys turn a whole page (months, the default) or one month (single), as Cally's page-by. |
show-outside-days |
showOutsideDays |
boolean |
false |
Show the days of the months before and after, in six weeks (Cally show-outside-days); by default they are blank and only the weeks the month needs show. Several months never show them. |
show-week-numbers |
showWeekNumbers |
boolean |
false |
A column of ISO week numbers before the weeks (Cally show-week-numbers). |
weekday-format |
weekdayFormat |
'narrow' | 'short' | '' |
'' |
Weekday headings narrow (S / อา) or short (Sun / อา.); by default narrow in Thai, short otherwise (Cally format-weekday). |
today |
today |
string |
'' |
The day marked as today, ISO (default the real today): for tests, demos and another time zone (Cally today). |
active-field |
activeField |
'start' | 'end' |
'start' |
Range mode: which end a pick will set; drives the preview highlight. |
min |
min |
string |
'' |
Minimum selectable ISO date. |
max |
max |
string |
'' |
Maximum selectable ISO date. |
locale |
locale |
string |
'' |
BCP 47 locale for names and labels. Defaults to the nearest lang. |
era |
era |
Era | '' |
'' |
Year era: be (พ.ศ.) or ce (ค.ศ.). Defaults to be for Thai locales. |
first-day |
firstDay |
number |
0 |
0 = Sunday … 6 = Saturday. |
show-today |
showToday |
boolean |
false |
Whether to display the "Today" footer shortcut button. |
Properties
| Property | Type | Description |
|---|---|---|
getDayParts |
(date: Date) => string | undefined |
Extra part names for a day, e.g. holiday (Cally getDayParts). |
focusDate |
Day that holds the roving tab stop; its month is shown. | |
isDateDisabled |
(date: Date) => boolean | string | undefined |
Callback to disable individual dates (e.g. weekends, holidays). |
multiValues |
string[] |
(read-only) Selected dates as clean ISO array in multi mode. |
Methods
| Method | Description |
|---|---|
focusDay() |
Puts DOM focus on the day that holds the roving tab stop. |
tabStops() |
The calendar's Tab stops in order: ‹, its own month and year selects (not when heading is slotted), ›, the day that holds the tab stop and Today. |
focus(options) |
Focus on the day with the tab stop, or with { target: 'previous' | 'next' } on a month arrow (Cally's focus()). |
Events
| Event | React | Description |
|---|---|---|
ui-page-change |
onUiPageChange |
Detail { start, end }, the first and last day shown after the months on show changed (Cally pagechange) |
ui-multi-pick |
onUiMultiPick |
Detail { date, values }, in multi mode when a day is toggled |
change |
none (use a ref) | Detail { value, endValue, values }, native-like change event on a pick (with range, once both ends are picked) |
ui-pick |
onUiPick |
Detail { date }, when a day is activated |
ui-focus-change |
onUiFocusChange |
Detail { date }, when keyboard or navigation moves the focused date |
ui-range-start |
onUiRangeStart |
Detail { date }, with range: the first end was picked (Cally rangestart) |
ui-range-end |
onUiRangeEnd |
Detail { date }, with range: the second end was picked (Cally rangeend) |
Slots
| Slot | Description |
|---|---|
previous |
Replaces the previous button's arrow icon |
next |
Replaces the next button's arrow icon |
heading |
Replaces the month and year selects; <ui-calendar-select-month> / <ui-calendar-select-year> put here follow the calendar |
CSS parts
| Part | Description |
|---|---|
months |
Multi-month layout container |
month-view |
Container of a single month |
month-title |
A month's name above its grid when two months show (the header then has the year only) |
header |
Month / year row container |
nav |
Previous / next navigation buttons |
prev-button |
The previous month button |
next-button |
The next month button |
heading |
The month and year selects' row (the heading slot) |
month-select |
The default heading's month select (<ui-calendar-select-month>'s select) |
year-select |
The default heading's year select (<ui-calendar-select-year>'s select) |
grid |
The table grid of days |
table |
The table grid of days |
thead |
The table header row with weekday labels |
th |
Individual weekday heading cell (also day-N, 0 = Sunday; the week-number heading also weeknumber) |
weeknumber |
A week-number cell (show-week-numbers) |
tbody |
The table body of weeks |
row |
Each week table row |
cell |
Each day table cell |
day |
Each day button; its state adds day-N (0 = Sunday), selected, today, outside (another month), disabled (before min / after max), disallowed (refused by isDateDisabled), range-start, range-end, in-range, and the names getDayParts returns |
today-button |
The optional "Today" footer button |
footer |
The footer container |
CSS custom properties
| Custom property | Default | Description |
|---|---|---|
--ui-calendar-day-radius |
Corner radius of a day button (default 9999px for circular days) | |
--ui-calendar-today-dot-radius |
Corner radius of today's indicator dot (default 50%) | |
--ui-calendar-day-focus |
The keyboard focus ring on a day | |
--ui-calendar-selected-focus |
Focus ring on a selected day |