Skip to content

Analytics

Mobile date range button

The compact date-range trigger used below md.
Available
Ports as-is
Dual breakpoint

Examples

Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.

Mobile date range button

Rendered live from Storybook

Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.

Props

The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.

PropTypeDefaultDescription
dateRange*string—Stored preset key (`"30d"`, `"ytd"`, …) or `"custom"`.
onDateRangeChange*(range: string) => void—Undocumented — add TSDoc to the prop in the library.
customStartDateDate—Undocumented — add TSDoc to the prop in the library.
customEndDateDate—Undocumented — add TSDoc to the prop in the library.
onCustomDateRangeChange(start: Date, end: Date) => void—Undocumented — add TSDoc to the prop in the library.
openboolean—Controlled panel state. Leave undefined for the button's own toggle, and use `defaultOpen` to pin a story to the open state.
defaultOpenbooleanfalseInitial panel state when uncontrolled.
onOpenChange(open: boolean) => void—Undocumented — add TSDoc to the prop in the library.
nowDateDATE_RANGE_DEFAULT_NOWReference "today" — resolves the relative presets.
epochDateDATE_RANGE_DEFAULT_EPOCHStart of the "All time" range.
presetsDateRangePresetOption[]—Override the panel's preset sidebar.
usePortalboolean—Render the panel into `document.body`. Off keeps it inside a docs block.

Reference

Transcribed from the component audit. If this disagrees with the source, the source is right.

Source
src/components/analytics/MobileDateRangeButton.tsx
Portability
Copies across unchanged — only the utils import path moves.
Responsive
Carries a load-bearing max-md: / md: pair. Sign off at both viewports — see the rule.