Popover

An accessible popup anchored to a button.

Installation

Install the component package, shared coss-svelte theme, and Bits UI peer.

npm install coss-svelte @coss-svelte/theme bits-ui

Usage

Import the Svelte component exports directly from the package.

import { Popover, PopoverClose, PopoverDescription, PopoverPopup, PopoverTitle, PopoverTrigger } from "coss-svelte";

Anatomy

  • Popover
  • PopoverClose
  • PopoverDescription
  • PopoverPopup
  • PopoverTitle
  • PopoverTrigger

API Reference

Popover

An accessible popup anchored to a button.

PropTypeDefaultDescription
bind:openbooleanfalseOpen state for the popup or disclosure. Bind with `bind:open`.
labelstring"Popover"Accessible label or fallback visible label for the control.
children : Snippet<[]>

Inherits from Bits UI Popover.Root.

PopoverClose

Renders a control that closes the parent surface.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI Popover.Close.

PopoverDescription

Provides supporting copy for the parent component.

children : Snippet<[]>

Inherits from Svelte <p> attributes.

PopoverPopup

Renders the floating or modal surface for the parent component.

PropTypeDefaultDescription
portalProps{ disabled?: boolean; to?: PortalTarget }{}Configures the exact Bits Portal target (`to`) or renders inline when `disabled`.
children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Popover.Content.

PopoverTitle

Names the parent surface or section.

children : Snippet<[]>

Inherits from Svelte <h2> attributes.

PopoverTrigger

Renders the control that opens, closes, or selects related content.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI Popover.Trigger.

Implementation Details

Status
Stable
Foundation
bits
Category
Overlays & Popups
Particles
3