GitHubGitHub
← All components
Overlays / component

Range popover

The chrome around a range selection: a trigger, a two-column floating panel with an absolute-range snippet beside quick presets, hover or click opening, and measured placement.

ClickHoverWith footer

Preset: 24h

<RangePopover bind:open triggerLabel="Last 6 hours" {quickGroups}>  {#snippet absolute()}    <DateRangePicker bind:from bind:to time />  {/snippet}</RangePopover>

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { RangePopover } from '@chanrg/4ui';<RangePopover bind:open triggerLabel="Last 6 hours" {quickGroups}>  {#snippet absolute()}    <DateRangePicker bind:from bind:to time />  {/snippet}</RangePopover>

Composition

Use the following composition to build a range popover:

RangePopover
├── trigger
├── absolute (snippet)
├── quickGroups
└── footer (snippet)

Click

The default: the trigger toggles the panel.

The trigger toggles the panel · preset: 24h

<RangePopover bind:open triggerLabel={label} {quickGroups}>  {#snippet absolute()}    <DateRangePicker bind:from bind:to time />  {/snippet}</RangePopover>

Hover

Set openMode="hover" to open on pointer enter, with a grace period for crossing onto the panel.

Point at the trigger — crossing onto the panel keeps it open

<RangePopover bind:open openMode="hover" triggerLabel={label} {quickGroups}>  {#snippet absolute()}    <DateRangePicker bind:from bind:to time />  {/snippet}</RangePopover>

API reference

Props

PropTypeDefaultDescription
openbooleanfalseBindable open state.
openModeclick | hoverclickHover adds mouseenter/focus opening with a 220ms leave grace.
quickGroupsRangeQuickGroup[][]Preset columns; a divider renders between groups.
absoluteSnippetrequiredThe whole left column — the host owns what "apply" means.
panelWidth / zIndexnumber428 / --4ui-z-popoverPanel width (clamped to the viewport) and stacking order.
ignoreDismiss() => booleanReturn true to suppress outside/Escape close while a modal is layered over the panel.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • The panel is a labelled dialog; the trigger reports aria-haspopup and aria-expanded.
  • Quick items are menuitemradio and track the active preset with aria-checked.
  • Escape and an outside pointer both dismiss, unless the host suppresses it.

Dependencies

dismiss action, floating placement