Install
Pull Popover from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Popover } from "@brika/clay";import { Popover } from "@brika/clay/components/popover";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
'use client';
import { Button } from '@brika/clay/components/button';
import { Input } from '@brika/clay/components/input';
import { Label } from '@brika/clay/components/label';
import {
Popover,
PopoverContent,
PopoverDescription,
PopoverHeader,
PopoverTitle,
PopoverTrigger,
} from '@brika/clay/components/popover';
/** Filter panel inside a popover, typical pattern for inline form controls. */
export default function PopoverDefaultDemo() {
return (
<Popover>
<PopoverTrigger asChild>
<Button variant="outline">Filter results</Button>
</PopoverTrigger>
<PopoverContent className="w-80">
<PopoverHeader>
<PopoverTitle>Filter</PopoverTitle>
<PopoverDescription>Narrow results by date range.</PopoverDescription>
</PopoverHeader>
<div className="mt-3 grid gap-3">
<div className="grid gap-1.5">
<Label htmlFor="pop-from">From</Label>
<Input id="pop-from" type="date" />
</div>
<div className="grid gap-1.5">
<Label htmlFor="pop-to">To</Label>
<Input id="pop-to" type="date" />
</div>
<Button className="w-full">Apply filter</Button>
</div>
</PopoverContent>
</Popover>
);
}Popover, every way
Accessibility
- Focus moves into the popover when it opens, Tab navigates within it.
- Escape and clicking outside close the popover and return focus to the trigger.
- Use
PopoveroverHoverCardwhen content must be keyboard-reachable. - The trigger carries
aria-expandedandaria-controlspointing to the panel.
Theme tokens
Every CSS variable Popover reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Popover
without touching component code.
Popover tokens
13 tokens--popover-surface-containercolorvar(--popover)components.popover.surfaceContainerBackground of the popover surface.
--popover-surface-labelcolorvar(--popover-foreground)components.popover.surfaceLabelDefault foreground color inside the popover surface.
--popover-description-colorcolorvar(--muted-foreground)components.popover.descriptionColorForeground color of `<PopoverDescription>` text shown beneath the popover title.
--popover-radiusradiusvar(--radius-surface)components.popover.radiusPopover corner radius.
--popover-padding-xsizecalc(var(--spacing) * 3)components.popover.paddingXInline padding inside the popover.
--popover-padding-ysizecalc(var(--spacing) * 3)components.popover.paddingYBlock padding inside the popover.
--popover-gapsizecalc(var(--spacing) * 2)components.popover.gapGap between adjacent children inside the popover.
--popover-border-widthborder-width1pxcomponents.popover.borderWidthBorder width on the popover. Set non-zero for outline-style variants.
--popover-border-styleborder-stylesolidcomponents.popover.borderStyleBorder style on the popover (`solid`, `dashed`, `double`, `none`).
--popover-shadowshadowvar(--shadow-overlay)components.popover.shadowPopover elevation.
--popover-backdrop-blurblur0pxcomponents.popover.backdropBlurBackdrop blur applied behind a translucent popover.
--popover-durationdurationvar(--motion-standard-duration)components.popover.durationTransition duration for popover state changes.
--popover-easingeasingvar(--motion-standard-easing)components.popover.easingTransition easing for popover state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.popover, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"popover": {
"paddingX": "calc(var(--spacing) * 3)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-popover-…) — see the
chips on each token row.
API reference
Props specific to Popover. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.
<Popover />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<PopoverAnchor />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<PopoverContent />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<PopoverDescription />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<PopoverHeader />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<PopoverTitle />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.
<PopoverTrigger />
passthroughNo wrapper-specific props, all attributes pass through to the underlying primitive.