Date Time Picker
Date time pickers help users select single dates, ranges, and optional time values.
Component Variations
Date picker
Can contains single date, date range
Date pickers with time
Can contains single date, date range with time.
States
Contains: Default, Success, Error, Warning
Dropdown Positions
Contains: Bottom-Left, Bottom-Center, Bottom-Right, Top-Left, Top-Center, Top-Right
Input Field Variations
Contains: Optional Label, Hint Text, Helper Text, Leading Icon
Optional
Optional
Usage Guidelines
Import
Import the date time picker component:
import-date-time-picker.ts
Copy code
Basic Usage
Simplest form of the date picker:
basic-usage-example.html
Copy code
Single Date Mode
Select a single date:
single-mode-example.html
Copy code
Range Date Mode
Select a date range:
range-mode-example.html
Copy code
Single Date Mode with Time
Select a single date with time:
single-with-time-example.html
Copy code
Range Date Mode with Time
Select a date range with time for both start and end:
range-with-time-example.html
Copy code
Dropdown Position
Control the calendar dropdown position:
dropdown-position-example.html
Copy code
All API Usage
Comprehensive example with all available properties and events:
date-time-picker-all-api.html
Copy code
API Reference
Inputs
Properties that can be passed to the component:
Property | Type | Default | Required | Description |
|---|---|---|---|---|
'single' | 'range' | 'single' | No | Picker mode - single date or date range | |
boolean | false | No | Whether to include time selection | |
string | - | No | Label text displayed above the picker | |
string | 'Select date' | No | Placeholder text shown when no value is selected | |
Date | DateRange | null | null | No | Currently selected value (date or date range) | |
boolean | false | No | Whether the picker is disabled | |
boolean | false | No | Whether the picker is optional | |
'success' | 'error' | 'warning' | null | null | No | Visual state of the picker | |
string | - | No | Helper text displayed below the picker | |
string | - | No | Hint text displayed in tooltip on ? icon next to label | |
boolean | false | No | Whether to show month and year selectors | |
'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | No | Position of the dropdown calendar relative to the input field | |
Date | - | No | Minimum selectable date | |
Date | - | No | Maximum selectable date | |
string | - | No | Icon displayed at the start |
Outputs
Events emitted by the component:
Property | Type | Description | Format |
|---|---|---|---|
EventEmitter<Date | DateRange | null> | Emitted when the selected value changes | Single mode: Date object or null. Range mode: { start: Date | null, end: Date | null } or null | |
EventEmitter<void> | Emitted when the input receives focus | No payload | |
EventEmitter<void> | Emitted when the input loses focus | No payload |
Best Practices
When to Use
- Use Date Time Picker when this pattern clearly supports the user task.
- Use it to keep similar interactions consistent across the product.
When Not to Use
- Avoid using Date Time Picker when a simpler component communicates the same intent.
- Avoid using it when the pattern introduces unnecessary interaction steps.
Design Guidelines
- Choose the appropriate mode (single/range) based on your use case
- Enable time selection only when needed - simpler is better
- Always provide clear labels indicating what should be selected
- Use helper text to clarify format or constraints
- Set min and max dates to constrain valid selections
- Use state prop to provide validation feedback
- Consider timezone handling when time selection is enabled
- Provide meaningful error messages for invalid selections
- Use consistent date/time formats across your application
- Keep labels, helper text, and actions concise and easy to scan.
- Use VD variants and states consistently for predictable behavior.
- Ensure keyboard access and clear focus order for accessibility.
Playground
Customize the date time picker features
example.html
Copy code