Navigated to /docs/ui/components/popover

Popover

Floating contextual panel that can contain arbitrary interactive or explanatory content.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.

TSX
tsximport { Popover } from "@tavojs/ui/popover";

The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/popover.

When to use

Use it when

Use Popover for filters, compact forms, calendars, help, or other contextual UI anchored to a trigger.

Choose something else when

Use DropdownMenu when every item is a command, Tooltip for a short non-interactive hint, and Dialog or Sheet for a focused modal workflow.

Examples

These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.

Popover example

TSXCreate: src/components/examples/PopoverExample1.tsx
tsximport { Popover } from "@tavojs/ui/popover";

export function PopoverExample1() {
  return (
    <>
      <Popover>
        <Popover.Trigger>Filters</Popover.Trigger>
        <Popover.Content>Filter controls go here.</Popover.Content>
      </Popover>
    </>
  );
}

Common props and defaults

A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
openboolean

Configures open for this component.
defaultOpenboolean

Configures defaultOpen for this component.
placement"bottom-start" | "bottom-end" | "top-start" | "top-end"

Configures placement for this component.
onOpenChange(open, reason) => void

Configures onOpenChange for this component.

Complete TypeScript API

Import from @tavojs/ui/popover. Published exports: Popover, PopoverClose, PopoverCloseProps, PopoverContent, PopoverContentProps, PopoverPlacement, PopoverProps, PopoverRoot, PopoverTrigger, PopoverTriggerProps.

PopoverProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Popover.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Popover.

idstring

No

Inherited id attribute accepted by Popover.

rolestring

No

Inherited role attribute accepted by Popover.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Popover.

titlestring

No

Inherited title attribute accepted by Popover.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Popover.

hiddenboolean

No

Inherited hidden attribute accepted by Popover.

disabledboolean

No

Inherited disabled attribute accepted by Popover.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Popover.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Popover.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Popover.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Popover.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Popover.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Popover.

openboolean

No

Configures open for this component.

defaultOpenboolean

No

Configures defaultOpen for this component.

placementPopoverPlacement

No

Configures placement for this component.

onOpenChange(open: boolean, reason: DisclosureOpenChangeReason) => void

No

Configures onOpenChange for this component.

PopoverTriggerProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Popover.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Popover.

idstring

No

Inherited id attribute accepted by Popover.

rolestring

No

Inherited role attribute accepted by Popover.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Popover.

titlestring

No

Inherited title attribute accepted by Popover.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Popover.

hiddenboolean

No

Inherited hidden attribute accepted by Popover.

disabledboolean

No

Inherited disabled attribute accepted by Popover.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Popover.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Popover.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Popover.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Popover.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Popover.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Popover.

labelstring

No

Inherited label attribute accepted by Popover.

PopoverContentProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Popover.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Popover.

idstring

No

Inherited id attribute accepted by Popover.

rolestring

No

Inherited role attribute accepted by Popover.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Popover.

titlestring

No

Inherited title attribute accepted by Popover.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Popover.

hiddenboolean

No

Inherited hidden attribute accepted by Popover.

disabledboolean

No

Inherited disabled attribute accepted by Popover.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Popover.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Popover.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Popover.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Popover.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Popover.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Popover.

useElementDirectiveInput<HTMLDivElement>

No

Inherited use attribute accepted by Popover.

PopoverCloseProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Popover.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Popover.

idstring

No

Inherited id attribute accepted by Popover.

rolestring

No

Inherited role attribute accepted by Popover.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Popover.

titlestring

No

Inherited title attribute accepted by Popover.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Popover.

hiddenboolean

No

Inherited hidden attribute accepted by Popover.

disabledboolean

No

Inherited disabled attribute accepted by Popover.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Popover.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Popover.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Popover.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Popover.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Popover.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Popover.

State ownership and DOM target

ConcernContract
StateUse defaultOpen for browser-owned disclosure state, or open with onOpenChange and update application state after each request.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

Public compound members: Root, Trigger, Content, Close

Limitations

Use DropdownMenu when every item is a command, Tooltip for a short non-interactive hint, and Dialog or Sheet for a focused modal workflow.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Trigger exposes `aria-haspopup="dialog"` and content uses dialog semantics.

  • Trigger exposes `aria-haspopup="dialog"` and content uses dialog semantics.

Component status

ContractCurrent value
Maturitystable
Categoryfeedback
Component import@tavojs/ui/popover
Explicit CSS import@tavojs/ui/css/popover
PreviewInteractive preview available on this page