Cassa UI

@cassa/ui-overlay

Layered UI — Dialog, Drawer, Popover, Dropdown Menu, Tooltip, and Tabs. Built on the native <dialog> element and the Popover API, with collision-aware positioning from @floating-ui/dom. Same tokens, CVA variants, and cn() merging as the rest of the system — dark mode is automatic.

Import

import {
  Dialog, DialogHeader, DialogTitle, DialogBody, DialogFooter,
  Drawer, DrawerHeader, DrawerTitle, DrawerBody,
  Popover, PopoverTrigger, PopoverContent,
  DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem,
  Tooltip,
  Tabs, TabList, Tab, TabPanel,
} from '@cassa/ui-overlay'

Dialog

A modal built on native <dialog> — focus trap, top-layer stacking, and ::backdrop come from the platform. Controlled through open / onClose.

PropTypeDefaultDescription
open*booleanControlled visibility.
onClose*() => voidCalled on every dismissal — Escape, backdrop click, or a close button.
size"sm" | "md" | "lg" | "xl""md"Max-width of the panel.
closeOnBackdropbooleantrueDismiss when the backdrop is clicked.
classNamestringMerged onto the native <dialog>.

Drawer

The same native-dialog foundation, sliding in from an edge. Composes with DrawerHeader / DrawerBody / DrawerFooter.

PropTypeDefaultDescription
open*booleanControlled visibility.
onClose*() => voidCalled on every dismissal.
side"right" | "left""right"Edge the panel slides in from.
closeOnBackdropbooleantrueDismiss when the backdrop is clicked.

Popover

Native Popover API for top-layer rendering and light dismiss, positioned against its trigger with automatic flip and shift. Controlled or uncontrolled.

PopoverTrigger renders the <button> itself — pass text and a className (e.g. buttonVariants(…) from @cassa/ui), not a nested <Button>. Same for DropdownMenuTrigger.

PropTypeDefaultDescription
openbooleanControlled open state. Omit for uncontrolled.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => voidFires whenever the open state changes.
placementPlacement"bottom-start"Preferred side. Flips automatically on collision.
offsetnumber6Gap in px between trigger and content.

Dropdown Menu

A Popover with menu semantics — role="menu", roving focus, arrow-key navigation, and close-on-select. Pair with DropdownMenuLabel and DropdownMenuSeparator.

PropTypeDefaultDescription
openbooleanControlled open state.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => voidFires whenever the open state changes.
placementPlacement"bottom-start"Preferred side. Flips on collision.

DropdownMenuItem

PropTypeDefaultDescription
onSelect() => voidFires on click or Enter/Space, then the menu closes.
tone"default" | "destructive""default"Visual emphasis.
disabledbooleanfalseSkips selection and keyboard focus.

Tooltip

Hover- and focus-triggered, with a configurable delay. Wraps its child in an inline span that carries aria-describedby.

PropTypeDefaultDescription
content*React.ReactNodeTooltip contents.
placementPlacement"top"Preferred side. Flips on collision.
delaynumber200Delay in ms before it opens on hover/focus.

Tabs

Pure WAI-ARIA tabs — roving tabIndex, arrow / Home / End keys, and aria-controls wiring. Only the active panel is mounted.

Arrow keys move between tabs; Home and End jump to the ends.
PropTypeDefaultDescription
defaultValue*stringActive tab on first render.
valuestringControlled active tab.
onValueChange(value: string) => voidFires when the active tab changes.

Positioning hook

useAnchoredPosition is exported for building your own anchored surfaces — it wraps computePosition and autoUpdate with offset, flip, and shift middleware.

const { setAnchor, setFloating, floatingStyles, placement } = useAnchoredPosition({
  placement: 'bottom-start',
  offset: 6,
  enabled: open,
});