Skip to content

Configuration and theming

Visual configuration matrix

Every picker combines these independent axes; each is a plain prop or an imported stylesheet, never a fork or a separate component:

AxisValuesSet via
Calendar systemjalali, gregoriansystem prop
Localeen, fa, ps (drives digits, month/weekday names, direction)locale prop
Precisiondate, date+time, date+time+timezoneWhich value type you pass in
Display formatlong/short, with/without weekday, Persian/Latin digitsdisplayFormat prop
Value format (storage)Gregorian ISO, Jalali object, and othersvalueFormat prop
Picker UI variantgrid popup (default), dropdown fieldsvariant prop (DatePicker only)
Themedefault, dark, compact, or any combinationWhich stylesheets you import

Headless or styled

Calendar (React and Vue) is the headless primitive: plain markup with data-jalali-* attributes and no required CSS, so you can restyle it completely. DatePicker is the same primitive with a popover and a default stylesheet around it. Import @jalali-js/react/date-picker.css (or the Vue equivalent) for a usable look with no styling work, or skip the import and style the data attributes yourself; nothing about the components requires the stylesheet to function.

The theming contract

date-picker.css expresses every rule through --jalali-* custom properties, not literal values. A theme is a stylesheet that overrides some subset of these on the same selectors ([data-jalali-datepicker-root], [data-jalali-datepicker-dropdown], [data-jalali-calendar-root]); it never redefines a rule.

VariableControls
--jalali-fontFont family
--jalali-font-sizeBase font size
--jalali-bgBackground color (input, popover)
--jalali-fgText color
--jalali-muted-fgSecondary text color (weekday headers, outside-month days)
--jalali-borderBorder color
--jalali-radiusCorner radius (input, popover, day cells, nav buttons)
--jalali-primaryAccent color: today's ring, selected/range-endpoint fill
--jalali-primary-fgText color on top of --jalali-primary
--jalali-shadowPopover drop shadow
--jalali-gapGap between grid cells
--jalali-input-paddingPadding inside the text input
--jalali-popover-paddingPadding inside the popover
--jalali-day-min-sizeMinimum width/height of a day cell

Because CSS custom properties inherit, a theme applies to every picker on the page once its stylesheet is imported: theming is a whole-app choice, not a per-instance prop. For a single themed section, scope your own override under a parent selector, following the same pattern (override the variables, never fight the rules).

Extra themes

@jalali-js/ui-react and @jalali-js/ui-vue ship two ready-made themes, each overriding a disjoint set of variables so they compose by importing both:

ts
import '@jalali-js/react/date-picker.css';
import '@jalali-js/ui-react/themes/dark.css'; // colors
import '@jalali-js/ui-react/themes/compact.css'; // spacing and sizing

Range picker and inline calendar

@jalali-js/ui-react (and @jalali-js/ui-vue) add two more components on the same headless primitives:

  • RangePicker: a start/end date-range picker. Two-click selection (first click sets the start, second sets the end and closes the popover); clicking before the current start restarts the range from the new point instead of erroring. Hovering after a start is picked previews the range a completed selection would produce.
  • InlineCalendar: Calendar re-exported under a more discoverable name, for an always-visible grid with no popover around it.

See the React and Vue guides for full prop lists, and the API reference for @jalali-js/ui-react's generated types.