SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

RangePicker

The time range for a dashboard, kept in the URL.

View code
tsx
<RangePicker
	value="7d"
	action="/examples/dashboard"
	params={{ monitor: "api" }}
	presets={[
		{ value: "24h", label: "24h", description: "Last 24 hours", key: "d" },
		{ value: "7d", label: "7d", description: "Last 7 days", key: "w" },
		{ value: "30d", label: "30d", description: "Last 30 days", key: "t" },
		{ value: "90d", label: "90d", description: "Last 90 days", key: "3" },
	]}
	custom={{ startName: "from", endName: "to", max: "2026-10-31", key: "c" }}
	labels={{ group: "Time range", apply: "Apply", custom: "Custom", start: "From", end: "To" }}
	mix={rangePickerKeys()}
/>

Demo apps

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { RangePicker } from "@sdxc/ui/app";

Renders the picker. Each preset is a submit button of a GET form, pressed when it is the range in effect; under a 24rem container the segments give way to a select with an Apply button. Attach rangePickerKeys() for letter keys and to submit the select on change.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
presetsreadonly Preset[]Yes
valuestringNoThe range in effect: a preset's value, or RANGE_PICKER_CUSTOM_VALUE.
namestringNo
actionstringNoWhere the forms submit; the current URL when omitted.
paramsReadonly<Record<string, string>>NoOther query parameters to keep, submitted as hidden fields (filters, the open tab).
customCustomNo
labelsLabelsYes
keyHintsbooleanNoShows each preset's key as a hint inside its segment.

Also accepts everything in Omit<TagProps<"div">, "children">.

@sdxc/ui

Can’t find it? Contact us