Compound Components

The styled package exposes a Compound Component API that gives you full control over the internal structure and rendering of each picker. Instead of a single monolithic component, you compose the picker from individual parts.

How It Works

Every picker (e.g. DatePicker) is both a simple component and a namespace of compound parts:

import { DatePicker } from "react-date-range-picker-styled";
import "react-date-range-picker-styled/rdrp-styles.css";
// Simple usage — renders default layout
<DatePicker value={value} onChange={setValue} />
// Compound usage — full control over structure
<DatePicker.Root value={value} onChange={setValue}>
<DatePicker.Trigger />
<DatePicker.Content>
<DatePicker.Header>
<DatePicker.PrevButton />
<DatePicker.Title />
<DatePicker.NextButton />
</DatePicker.Header>
<DatePicker.Grid />
<DatePicker.Footer>
<DatePicker.ClearButton />
<DatePicker.CancelButton />
<DatePicker.ConfirmButton />
</DatePicker.Footer>
</DatePicker.Content>
</DatePicker.Root>

Available Parts

DatePicker

PartDescription
DatePicker.RootProvider + container. Accepts all picker props (value, onChange, minDate, etc.)
DatePicker.TriggerButton that opens/closes the popup. Displays selected value.
DatePicker.ContentPopup container (or inline container when inline is set on Root)
DatePicker.HeaderMonth navigation row
DatePicker.PrevButtonNavigate to previous month
DatePicker.NextButtonNavigate to next month
DatePicker.TitleCurrent month/year display (supports dropdown selects)
DatePicker.GridCalendar grid with weekday headers and day cells
DatePicker.DayIndividual day cell (used inside Grid’s render prop)
DatePicker.FooterAction button container
DatePicker.ClearButtonClears the selected value
DatePicker.CancelButtonCancels and closes
DatePicker.ConfirmButtonConfirms selection
DatePicker.TodayButtonNavigates to today

DateRangePicker

Includes all the parts above plus:

PartDescription
DateRangePicker.CalendarsDual calendar container
DateRangePicker.PresetsPreset range sidebar container
DateRangePicker.PresetItemIndividual preset button

DateTimePicker / DateRangeTimePicker

Include their respective base parts plus time panel integration via the simple API. Time panels are rendered automatically when using compound parts with time-enabled pickers.