UI

Date (Range) Picker

A simple yet powerful Date (Range) Picker.

Date Picker

Date Range Picker

Import DatePicker

Tremor exports one component to build a DatePicker. The type of its value,DatePickerValue is exported as well.

import { DatePicker, DatePickerValue } from '@tremor/react';

Usage example date picker

The example below renders a date picker.

Import DateRangePicker

Tremor exports two components to build a DateRangePicker. The type of its value, DateRangePickerValue is exported as well.

import { DateRangePicker, DateRangePickerValue } from '@tremor/react';

Usage example date range picker

The example below shows a date range picker without the relative dates menu.

Usage example with controlled state and Spanish localization and custom select values

The example below shows a date range picker with a controlled state and the Spanish locale, e.g. { es }. Note that for all locales other than English { enUS } you have to import the locale from date-fns.

API Reference: Date (Range) Picker

client component
value
DateRangePickerValue = { from?: Date | undefined, to?: Date | undefined, selectValue?: string | undefined }
Sets the date range.
defaultValue
DateRangePickerValue = { from?: Date | undefined, to?: Date | undefined, selectValue?: string | undefined }
Sets the date range.
onValueChange
(value: DateRangePickerValue) => void
Event handler called when the state of the datepicker changes.
enableSelect (Range Picker Only)
boolean
Enables a select menu.
minDate
Date
Controls the mininmum available date.
maxDate
Date
Controls the maximum available date.
disabledDates
Date[]
Disable one or more dates
placeholder
string
Sets the placeholder text of the DateRangePicker
selectPlaceholder
string
Sets the placeholder text of the optional select
disabled
boolean
Set the state of the element to disabled.
locale
locale
Sets the placeholder text of the optional Date Range Dropdown. Note that for all locales other than English {enUS} you have to import the locale from `date-fns`. E.g. {frCH} for French locale (Switzerland)
displayFormat
string
Format the in the a given format. The result may vary by locale.
enableClear
boolean
Enables the ability to clear a date range selection.
enableYearNavigation
boolean
Adds additional buttons to navigate through years.
weekStartsOn
Number
Set an index for the first day of the week. Where 0 = Sunday, 1 = Monday, ...).

Theming

DateRangePicker, DatePicker

Roundness
borderRadiustremor-default
Shadow
boxShadowtremor-input
Font size
fontSizetremor-default
Border color
colorstremor-border-DEFAULT
Border color focus
colorstremor-brand-subtle
Ring color focus
colorstremor-brand-muted
XCircle
colorstremor-content-subtle
Background color
colorstremor-background-DEFAULT
Background color disabled
colorstremor-background-subtle
Background color hover
colorstremor-background-muted
Text color no selection
colorstremor-content-DEFAULT
Text color with selection
colorstremor-content-emphasis
Text color disabled
colorstremor-content-muted
Dropdown: Roundness
borderRadiustremor-default
Dropdown: Shadow
boxShadowtremor-dropdown
Dropdown: Background color
colortremor-background
Dropdown: border color
colorstremor-border-DEFAULT
Dropdown: Caption text color
colorstremor-content-emphasis
Dropdown: Caption text size
fontSizetremor-default
Dropdown: Navigation button border color
colorstremor-border
Dropdown: Navigation button border color focused
colorstremor-brand-subtle
Dropdown: Navigation button ring color focused
colorstremor-brand-muted
Dropdown: Navigation button arrow color
colorstremor-content-subtle
Dropdown: Navigation button arrow color hover
colorstremor-content-DEFAULT
Dropdown: Navigation button background color hover
colorstremor-border-muted
Dropdown: Navigation button roundness
borderRadiustremor-small
Dropdown: Head cell (weekdays) text color
colorstremor-content-subtle
Dropdown: Cell text color font size
fontSizetremor-default
Dropdown: Cell roundness
borderRadiustremor-default
Dropdown: Cell text color
colorstremor-content-emphasis
Dropdown: Cell background color hover
colorstremor-background-subtle
Dropdown: Cell outline color
colorstremor-brand
Dropdown: Cell text color selected
colorstremor-content-inverted
Dropdown: Cell background color selected
colorstremor-background-emphasis
Dropdown: Cell text color
colorstremor-content-subtle
Dropdown: Date range middle background color
colorstremor-background-subtle
Dropdown: Date range middle text color
colorstremor-content-DEFAULT
Dropdown: Day outside text color
colorstremor-content-subtle
Dropdown: Date range start/end text color
colorstremor-brand-inverted
Dropdown: Date range start/end roundness
borderRadiustremor-brand-inverted

DateRangePickerItem

Font size
fontSizetremor-default
Text color
colorstremor-content-emphasis
Background color hover
colorstremor-background-muted
Text color hover
colorstremor-content-strong
Background color selected
colorstremor-background-muted
Text color selected
colorstremor-content-strong
Icon (SelectItem, SearchSelectItem)
colorstremor-content-subtle