Rime

DateRangeFilter

A date-range chip for filter rows: presets plus a two-month range calendar.

DateRangeFilter is the date filter in a FilterBar. It reads as a chip like Select's, with presets (last 7 days, this month) and a range calendar.

Installation

npx shadcn@latest add KezLahd/rime/date-range-filter

Also installs: base, button, date-field, field, icon.

Usage

import { DateRangeFilter } from "@/components/ui";

<DateRangeFilter aria-label="Issued" value={range} onChange={setRange} />

Examples

Open

inline shows the presets and calendars open under the chip, in place.

Chip

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

DateRangeFilter

DateRangeFilter props
PropTypeDefaultDescription
valueRequiredDateRangeBoth null = no filter. A half-picked range never reaches onChange.
onChangeRequired(value: DateRange) => void
presetsReadonlyArray<DateRangePreset>DEFAULT_DATE_RANGE_PRESETS
minIsoDate
maxIsoDate
isDateDisabled(date: IsoDate) => boolean
placeholderstring"All dates"Shown when no range is set.
appearance"chip" | "field""chip"chip = 32px filter-bar chip. field = form-control height, beside Select.
months1 | 2Calendars side by side. Defaults to 2, or 1 under 640px.
disabledboolean
invalidboolean
idstring
aria-labelstringNames the control. The current range is appended, so it is read too.
classNamestring
inlinebooleanfalseShow the panel open, in place under the trigger: no portal, no focus move, no outside-click listener. For docs and thumbnails.

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

DateRangeFilter per-component tokens
TokenDefaultLive value
--chip-heightvar(--control-h-sm)…
--chip-radiusvar(--r-sm)…
--field-focus-borderrgba(var(--rgb-brand), 0.7)…
--field-focus-ringvar(--focus-halo)…
--field-focus-ring-invalid0 0 0 4px rgba(var(--rgb-danger), 0.14)…

System tokens it reads

DateRangeFilter system tokens
TokenDefaultLive value
--brand-deeptokens.css…
--chip-active-filltokens.css…
--chip-active-fill-hovertokens.css…
--chip-active-shadowtokens.css…
--control-h-smtokens.css…
--danger-basetokens.css…
--densitytokens.css…
--durtokens.css…
--dur-fasttokens.css…
--easetokens.css…
--ease-outtokens.css…
--focus-colortokens.css…
--focus-gaptokens.css…
--focus-halotokens.css…
--focus-ringtokens.css…
--font-bodytokens.css…
--ink-bodytokens.css…
--ink-brandtokens.css…
--ink-disabledtokens.css…
--ink-mutedtokens.css…
--linetokens.css…
--line-brandtokens.css…
--line-softtokens.css…
--r-2xstokens.css…
--r-lgtokens.css…
--r-mdtokens.css…
--r-smtokens.css…
--r-xstokens.css…
--recess-filltokens.css…
--recess-fill-hovertokens.css…
--rgb-brandtokens.css…
--rgb-brand-deeptokens.css…
--rgb-contacttokens.css…
--rgb-dangertokens.css…
--rgb-whitetokens.css…
--shadow-menutokens.css…
--shadow-recesstokens.css…
--surface-solidtokens.css…
--text-captiontokens.css…
--text-inputtokens.css…
--text-smalltokens.css…
--wash-activetokens.css…
--wash-rowtokens.css…
--wash-strongtokens.css…
--wash-subtletokens.css…
--z-popovertokens.css…

Accessibility

  • The clear button is a separate control, so the trigger never nests a button.

Do and don't

Do

  • Put it after the Select chips in a FilterBar.

Don't

  • Don't use it for a single date; that is DateField.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open date-range-filter.md