DatePicker Public Interface
All attributes, methods, events, and callbacks available on the <web-daterangepicker> element.
Public API
Attributes, methods, events, and callbacks
Attributes
| Attribute | Type | Default |
|---|---|---|
auto-close | never | selection | apply | selection |
calendar-open-trigger | focus | typing | manual | focus |
calendar-placement | string (Floating UI) | bottom-start |
cell-size | xs | sm | md | lg | xl | md |
date-format-mask | string | YYYY-MM-DD |
disabled | boolean | false |
disabled-dates-handling | allow | prevent | block | split | individual | allow |
disabled-weekdays | string (comma-sep) | - |
display-format-mask | string | - |
font-size | xs | sm | md | lg | xl | md |
grid-columns | number | - |
grid-rows | number | - |
highlight-disabled-in-range | boolean | true |
initial-date | string (YYYY-MM-DD) | today |
locale | string | auto | auto |
max-date | string (YYYY-MM-DD) | - |
min-date | string (YYYY-MM-DD) | - |
month-layout | horizontal | grid | horizontal |
placeholder | string | - |
positioning-mode | floating | inline | floating |
rolling-month-range | string (MM-MM) | 01-12 |
rolling-year-range | string (YYYY or YYYY-YYYY) | ±1 year |
selection-mode | single | range | multiple | single |
show-apply-button | boolean | auto |
show-clear-button | boolean | true |
show-today-button | boolean | true |
spacing | xs | sm | md | lg | xl | md |
unified-header-interactive | boolean | false |
unified-navigation | boolean | false |
unified-navigation-anchor-index | number | 0 |
value | string | - |
visible-months-count | number | 1 |
week-start-day | auto | 0-6 | auto |
Methods
| Method | Returns | Description |
|---|---|---|
clearSelection() | void | Clear current selection |
destroy() | void | Destroy picker instance |
getInputValue() | string | Get input value as string |
getSelectedDate() | Date | null | Get selected date (single mode) |
getSelectedRange() | DateRange | null | Get selected range (range mode) |
hide() | void | Hide the calendar popup |
setInputValue(value) | void | Set input value |
show() | void | Show the calendar popup |
toggle() | void | Toggle calendar visibility |
Events & Callbacks
| Event/Callback | Type | Description |
|---|---|---|
| DOM Events | ||
calendar-hide | CustomEvent | Fired when calendar closes |
calendar-show | CustomEvent | Fired when calendar opens |
date-change | CustomEvent | Fired when selection changes |
date-select | CustomEvent | Fired when date(s) selected |
| Callback Properties | ||
badgeTooltipCallback | Function | Custom badge tooltip HTML |
beforeDateSelectCallback | Function | Validate/adjust before selection |
beforeMonthChangedCallback | Function | Bulk load metadata before render |
customStylesCallback | Function | Inject CSS into Shadow DOM |
dayTooltipCallback | Function | Custom day tooltip HTML |
formatSummaryCallback | Function | Custom summary formatting |
getDateMetadataCallback | Function | Return DateInfo for custom styling |
getUnifiedHeaderCallback | Function | Custom unified header text |
onSelect | Function | Called on date selection |
renderDayCallback | Function | Full custom day cell rendering |
renderDayContentCallback | Function | Augment default day rendering |
CSS Custom Properties
Version 1.3.0 includes 90+ CSS custom properties for complete theming control. Variables are organized into base variables (foundation) and semantic component-specific variables.
Base Variables
Foundation colors, typography, spacing, and layout properties
Colors & Typography
| Variable | Default |
|---|---|
| Colors | |
--drp-accent-color | #3b82f6 |
--drp-accent-color-hover | #2563eb |
--drp-accent-text-color | #ffffff |
--drp-border-color | #e5e7eb |
--drp-card-bg | #ffffff |
--drp-primary-bg | #f3f4f6 |
--drp-primary-bg-hover | #e5e7eb |
--drp-text-primary | #111827 |
--drp-text-secondary | #6b7280 |
| Typography | |
--drp-font-size-base | 1rem |
--drp-font-size-lg | 1.125rem |
--drp-font-size-sm | 0.875rem |
--drp-font-size-xs | 0.75rem |
--drp-font-weight-medium | 500 |
--drp-font-weight-normal | 400 |
--drp-font-weight-semibold | 600 |
Spacing & Other
| Variable | Default |
|---|---|
| Spacing | |
--drp-spacing-lg | 1.5rem |
--drp-spacing-md | 1rem |
--drp-spacing-sm | 0.5rem |
--drp-spacing-xl | 2rem |
--drp-spacing-xs | 0.25rem |
| Layout | |
--drp-border-radius | 0.375rem |
--drp-border-width-base | 1px |
--drp-shadow-xl | 0 20px 25px... |
| Transitions | |
--drp-easing-snappy | cubic-bezier(...) |
--drp-transition-base | 200ms |
--drp-transition-fast | 150ms |
Description
Input Variables
New in v1.3.0 - Complete input element styling control
Input Colors
| Variable | Default |
|---|---|
--drp-input-background | --drp-card-bg |
--drp-input-color | --drp-text-primary |
--drp-input-border-color | --drp-border-color |
--drp-input-border-color-hover | --drp-accent-color |
--drp-input-border-color-focus | --drp-accent-color |
--drp-input-placeholder-color | --drp-text-secondary |
--drp-input-disabled-background | --drp-primary-bg |
Input Sizes
| Variable | Default |
|---|---|
--drp-input-size-xs-height | 3.1rem (31px) |
--drp-input-size-sm-height | 3.3rem (33px) |
--drp-input-size-md-height | 3.5rem (35px) |
--drp-input-size-lg-height | 3.8rem (38px) |
--drp-input-size-xl-height | 4.1rem (41px) |
Input States
| Variable | Default |
|---|---|
--drp-input-focus-shadow-color | rgba(59, 130, 246, 0.1) |
--drp-input-focus-shadow-size | 3px |
--drp-input-icon-opacity | 0.5 |
Day Cell Variables
New in v1.3.0 - Day cell colors, states, and interactions
Basic States
| Variable | Default |
|---|---|
--drp-day-bg-hover | --drp-primary-bg |
--drp-day-border-hover | --drp-accent-color |
--drp-day-disabled-color | --drp-text-secondary |
--drp-day-other-month-color | --drp-text-secondary |
--drp-day-text-color | --drp-text-primary |
--drp-day-today-border | --drp-accent-color |
--drp-weekday-color | --drp-text-secondary |
Selection States
| Variable | Default |
|---|---|
--drp-day-focused-outline | --drp-accent-color |
--drp-day-selected-bg | --drp-accent-color |
--drp-day-selected-bg-hover | --drp-accent-color-hover |
--drp-day-selected-color | --drp-accent-text-color |
Range States
| Variable | Default |
|---|---|
--drp-day-range-bg | --drp-accent-color |
--drp-day-range-color | --drp-accent-text-color |
Header & Navigation Variables
New in v1.3.0 - Header, navigation buttons, and rolling selector
Header
| Variable | Default |
|---|---|
--drp-header-bg-active | --drp-primary-bg-hover |
--drp-header-bg-hover | --drp-primary-bg |
--drp-header-text-color | --drp-text-primary |
--drp-unified-month-color | --drp-text-secondary |
--drp-unified-range-bg-hover | --drp-primary-bg |
--drp-unified-range-text-color | --drp-text-primary |
Navigation Buttons
| Variable | Default |
|---|---|
--drp-nav-bg-active | --drp-primary-bg-hover |
--drp-nav-bg-hover | --drp-primary-bg |
--drp-nav-border-color | --drp-border-color |
--drp-nav-border-hover | --drp-accent-color |
--drp-nav-text-color | --drp-text-primary |
Rolling Selector
| Variable | Default |
|---|---|
--drp-rolling-bg | --drp-primary-bg |
--drp-rolling-border-color | --drp-border-color |
--drp-rolling-item-bg-hover | --drp-primary-bg |
--drp-rolling-item-bg-selected | --drp-accent-color |
--drp-rolling-item-color-selected | --drp-accent-text-color |
Button & Summary Variables
New in v1.3.0 - Action buttons and summary section
Button States
| Variable | Default |
|---|---|
--drp-button-bg-hover | --drp-primary-bg |
--drp-button-border-color | --drp-border-color |
--drp-button-border-hover | --drp-accent-color |
Button Types
| Variable | Default |
|---|---|
--drp-button-apply-bg | --drp-accent-color |
--drp-button-apply-bg-hover | --drp-accent-color-hover |
--drp-button-apply-color | white |
--drp-button-cancel-color | --drp-text-secondary |
--drp-button-clear-color | --drp-text-secondary |
--drp-button-today-color | --drp-accent-color |
Summary
| Variable | Default |
|---|---|
--drp-summary-border-color | --drp-border-color |
--drp-summary-count-color | --drp-accent-color |
--drp-summary-text-color | --drp-text-secondary |
Badge Variables
New in v1.3.0 - Badge styling for special dates
Badge Types
| Variable | Default | Description |
|---|---|---|
--drp-badge-number-bg | --drp-accent-color | Number badge background |
--drp-badge-number-color | --drp-accent-text-color | Number badge text |
--drp-badge-count-bg | #ef4444 | Count badge background |
--drp-badge-count-color | #ffffff | Count badge text |
--drp-badge-text-bg | --drp-text-secondary | Text badge background |
--drp-badge-text-color | #ffffff | Text badge text |