The date picker provides four independent sizing systems that can be controlled via attributes, plus complete theming via CSS custom properties.
Four Independent Systems:
input-sizeattribute - Controls input field size (floating mode only) New in v1.4.0font-sizeattribute - Controls calendar text size onlyspacingattribute - Controls calendar gaps, padding, margins onlycell-sizeattribute - Controls day cell dimensions and structural sizes only
All four systems use the same 5-level scale: xs, sm, md (default), lg, xl
Input Size (New in v1.4.0)
Control input field size independently from calendar size
Live Demo
Code Examples
Details
New in v1.4.0
The input-size attribute controls the input field dimensions independently from calendar sizing.
Available Sizes
xs- 3.1rem / 31px (very compact)sm- 3.3rem / 33px (compact)md- 3.5rem / 35px (default)lg- 3.8rem / 38px (spacious)xl- 4.1rem / 41px (touch-friendly)
Use Cases
- Floating mode only - This attribute applies to the input field in floating/popup mode
- Coordinated sizing - Use same size for input and calendar for consistent UI
- Mixed sizing - Large touch-friendly input with compact popup calendar
CSS Variables
Each size has corresponding CSS variables:
--drp-input-size-{size}-font--drp-input-size-{size}-padding-v--drp-input-size-{size}-padding-h--drp-input-size-{size}-height--drp-input-size-{size}-icon-size
Coordinated Input + Calendar Sizing
Combine input-size with calendar sizing for consistent UI
Live Demo
Code
Details
Consistent UI
For consistent visual design, use the same size value across all four attributes.
Mixed Sizing Strategy
Sometimes you want different sizes for input and calendar:
- Large input + compact calendar - Touch-friendly input that opens a space-efficient popup
- Small input + large calendar - Compact form field with spacious date selection
Calendar Sizing Systems
Control font, spacing, and cell dimensions independently
Live Demo
Code Examples
How It Works
Independence
Each system works independently - combine them any way you like!
- Font Size:
font-size="xs|sm|md|lg|xl"- Text size only - Spacing:
spacing="xs|sm|md|lg|xl"- Gaps, padding, margins only - Cell Size:
cell-size="xs|sm|md|lg|xl"- Day cell dimensions only
Scale Values
xs- 0.6Ã scale (60% of normal size)sm- 0.8Ã scale (80% of normal size)md- 1.0Ã scale (baseline, default)lg- 1.5Ã scale (150% of normal size)xl- 2.0Ã scale (200% of normal size)
Uniform Sizing
All three systems scaled together uniformly
Live Demo
Code Examples
Use Cases
When to Use Uniform Sizing
- xs - Dense dashboards, data tables, compact layouts
- sm - Mobile apps, modals, forms
- md - Default size, general use
- lg - Desktop applications, spacious layouts
- xl - Touch interfaces, accessibility, presentations
Balanced Proportions
Using the same size for all three systems creates balanced, proportional calendars.
Compact Grid Layout
Dense dashboard calendar at 60% scale
Live Demo
Code Example
Details
Use Case
Extra Small (xs) - Perfect for dense dashboards with limited space
Grid Layout Requirements
visible-months-count must equal grid-rows à grid-columns
Example: 2 rows à 3 columns = 6 months
Touch-Friendly 2Ã3 Grid (Large - 150%)
Large calendar with generous touch targets - ideal for touch interfaces and accessibility
Code
CSS Custom Properties (Theming)
Customize colors, borders, and more with CSS variables
Available Variables
đ New in v1.3.0: Semantic Component Variables
Version 1.3.0 adds 60+ semantic CSS variables for component-specific customization. Each component (input, buttons, days, headers) now has dedicated variables for complete styling independence.
Total available: 90+ CSS custom properties
Base Color Variables
--drp-card-bg- Calendar background (#ffffff)--drp-accent-color- Primary accent (#3b82f6)--drp-accent-color-hover- Accent hover (#2563eb)--drp-text-primary- Primary text (#111827)--drp-text-secondary- Secondary text (#6b7280)--drp-border-color- Border color (#e5e7eb)--drp-primary-bg- Primary background (#f3f4f6)--drp-primary-bg-hover- Primary hover (#e5e7eb)
Component-Specific Variables (New in v1.3.0)
- Input:
--drp-input-background,--drp-input-color,--drp-input-border-color, and 9 more - Buttons:
--drp-button-today-color,--drp-button-apply-bg, and 8 more - Day Cells:
--drp-day-text-color,--drp-day-selected-bg, and 10 more - Header/Nav:
--drp-header-text-color,--drp-nav-bg-hover, and 14 more - Badges:
--drp-badge-number-bg,--drp-badge-count-bg, and 4 more
Spacing Variables
--drp-spacing-xs- Extra small (0.25rem)--drp-spacing-sm- Small (0.5rem)--drp-spacing-md- Medium (1rem)--drp-spacing-lg- Large (1.5rem)--drp-spacing-xl- Extra large (2rem)
Typography Variables
--drp-font-size-base- Base font size (1rem)--drp-font-size-sm- Small (0.875rem)--drp-font-size-lg- Large (1.125rem)--drp-font-weight-medium- Medium weight (500)--drp-font-weight-semibold- Semibold (600)
Other Variables
--drp-border-radius- Border radius (0.375rem)--drp-shadow-xl- Extra large shadow--drp-transition-fast- Fast transition (150ms)
Complete list: See API Reference - CSS Custom Properties for all 90+ variables.
Code Examples
How to Use
How CSS Variables Work
The component defines all variables with :host inside its Shadow DOM. You can override them from outside:
- Global - Target
web-daterangepickerselector - Scoped - Add a class and target
web-daterangepicker.your-class - Instance - Use inline styles (not recommended)
Benefits
- Scoped - Theme individual pickers differently
- Dynamic - Change themes at runtime with JavaScript
- Maintainable - No need to modify component source
- Performant - Browser-native CSS variable support
v1.3.0: Component Independence
The decoupled architecture means:
- Independent styling - Customize inputs without affecting calendar
- Component isolation - Change button colors without affecting day cells
- Flexible theming - Override base OR semantic variables
- Backwards compatible - All existing themes still work
Complete Documentation
See API.md - CSS Custom Properties for:
- Full list of all 90+ variables
- Default values for each variable
- Dark theme example
- Multiple theme switching
âšī¸ Input Field Styling (Updated in v1.3.0)
v1.3.0 adds comprehensive input styling with the .drp-input class and 12 new CSS custom properties.
New Input Variables (v1.3.0)
--drp-input-background- Input background color--drp-input-color- Input text color--drp-input-border-color- Border color--drp-input-border-color-hover- Border on hover--drp-input-border-color-focus- Border when focused--drp-input-placeholder-color- Placeholder text--drp-input-focus-shadow-color- Focus ring color
Size Variants
Three size variants available: .drp-input--sm, default (md), and .drp-input--lg
Shadow DOM Limitation
The date picker uses Shadow DOM for style isolation. The <input> element lives in the light DOM (your page),
while the calendar lives in the shadow DOM (component internals). Styles inside shadow DOM cannot reach out to style light DOM elements.
Styling Options
You have two options for styling the input:
Option 1: Override CSS variables (v1.3.0+)
Option 2: Direct CSS styling
Option 3: Provide Your Own Input
You can provide a pre-styled input element:
Framework Examples
đ Complete documentation: See the Known Limitations section in the API reference for detailed examples and workarounds.
Quick Reference
Sizing Attributes
| Attribute | Values | Default |
|---|---|---|
input-size v1.4.0 | xs, sm, md, lg, xl | md |
font-size | xs, sm, md, lg, xl | md |
spacing | xs, sm, md, lg, xl | md |
cell-size | xs, sm, md, lg, xl | md |
Scale Values
| Size | Scale | Percentage |
|---|---|---|
| xs | 0.6Ã | 60% |
| sm | 0.8Ã | 80% |
| md | 1.0Ã | 100% |
| lg | 1.5Ã | 150% |
| xl | 2.0Ã | 200% |