suiss/ui · Component
Popover
A floating panel anchored to a trigger, for supplementary content and lightweight controls.
Popover is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Popover wraps the popover primitive of the chosen base. Popover is the root that holds the open state, PopoverTrigger toggles it, and PopoverContent renders the positioned panel in a portal. Inside the content, PopoverHeader groups a PopoverTitle and PopoverDescription above any other content, such as form fields.
Use a popover for interactive content that relates to its trigger. Use Tooltip for short, non-interactive hints, and Dialog when the task needs the user's full attention.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies and add the
cnhelper:
- Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Composition
Use the following composition to build a Popover:
Examples
Sides
Set the side prop on PopoverContent to open the panel on the top, right, bottom or left of its trigger.
Simple
A plain text popover opened from a ghost button. PopoverHeader is optional, so the content can be plain text.
Accessibility
- The panel has the
dialogrole.PopoverTitleprovides its accessible name andPopoverDescriptionits accessible description. - The trigger exposes
aria-expanded. - Escape closes the popover and returns focus to the trigger.
- Clicking outside the panel, or clicking the trigger again, closes it.
API Reference
Popover
The root that manages the popover's open state.
Also accepts the props of the primitive part it wraps.
The popover is uncontrolled by default; set defaultOpen to start open, or control it with open and onOpenChange. Use the trigger's render prop to render it as another component, such as a Button.
The popover is uncontrolled by default; set defaultOpen to start open, or control it with open and onOpenChange. Set asChild on PopoverTrigger to render another component, such as a Button, as the trigger.
The popover is uncontrolled by default; set defaultOpen to start open, or control it with isOpen and onOpenChange. The Button placed first inside Popover opens it.
PopoverTrigger
The button that opens and closes the popover.
Also accepts the props of the primitive part it wraps.
PopoverContent
The positioned panel that renders in a portal.
| Prop | Type | Default |
|---|---|---|
side | "top" | "right" | "bottom" | "left" | "inline-start" | "inline-end" | "bottom" |
sideOffset | number | 4 |
align | "start" | "center" | "end" | "center" |
alignOffset | number | 0 |
| Prop | Type | Default |
|---|---|---|
side | "top" | "right" | "bottom" | "left" | "bottom" |
sideOffset | number | 4 |
align | "start" | "center" | "end" | "center" |
alignOffset | number | 0 |
Also accepts the props of the primitive parts it wraps.
side sets which side of the trigger the panel opens on, and align how it lines up with the trigger along that side. sideOffset is the gap in pixels between the trigger and the panel, and alignOffset the offset in pixels along the alignment axis. The panel is w-72 by default; override it with className. It animates in from the side it opens on.
PopoverHeader
Groups the title and description at the top of the panel.
Also accepts the props of React.ComponentProps<"div">.
PopoverTitle
The heading that names the popover.
Also accepts the props of the primitive part it wraps.
PopoverDescription
Secondary text that describes the popover.
Also accepts the props of the primitive part it wraps.
Each part sets a data-slot, such as popover-content or popover-title, for styling. The Popover root renders no element of its own.
Web preview
Popover positions a panel next to its PopoverTrigger. PopoverContent renders in a portal, is placed on any side with an align and offsets, and animates in with a short fade, scale and slide using Reanimated. On iOS the content is wrapped in a FullWindowOverlay from react-native-screens, so it draws above native modals.
Use PopoverHeader, PopoverTitle and PopoverDescription to label the panel. For short hints, use Tooltip instead.
Installation
The CLI also adds what it builds on: Text. It also adds the animated view components/ui/animated-view.tsx.
- Install the following dependencies:
-
Add the pieces it builds on: Text.
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/popover.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Text.
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/popover.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Add the pieces it builds on: Text.
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/popover.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Default
Web preview
Sides
Popovers that open on each of the four sides of their triggers.
Web preview
Simple
A short text popover aligned to the start of its trigger.
Web preview
Detached triggers
Several triggers share one popover, and each passes its own payload.

The React Native tab shows 1 more example.
Accessibility
- The panel has the
dialogrole and is labeled byPopoverTitlewhen one is present. PopoverTitlehas theheadingrole.- When the popover opens, focus moves to the title by default.
- The popover can close from an outside press, the Android back button, or the screen reader escape gesture.
- Animations follow the system reduce motion setting.
API Reference
Popover
The root that manages the open state.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (open: boolean, details) => void | - |
modal | boolean | false |
The popover is uncontrolled by default. Use defaultOpen to start open, or open with onOpenChange to control it. onOpenChangeComplete runs after the open or close animation. modal blocks interaction with the rest of the screen while open.
To share one popover between several triggers, create a handle with createHandle from the popover primitive, pass it as handle to the Popover and each PopoverTrigger, and give each trigger a payload. The Popover children can be a function that receives the active payload.
Pass a render element to PopoverTrigger, such as a Button, to use your own pressable.
PopoverContent
Animated panel rendered in a portal and positioned next to the trigger.
| Prop | Type | Default |
|---|---|---|
portalHost | string | - |
Also accepts the props of React.ComponentProps<typeof PopoverPrimitive.Popup>, React.ComponentProps<typeof PopoverPrimitive.Positioner>.
Use portalHost to render into a named portal host. On iOS the content is wrapped in a FullWindowOverlay; on Android it renders in the portal directly. The panel uses bg-popover, a subtle border-foreground/5 border (border-foreground/10 in dark mode) and shadow-lg.
PopoverHeader
Column for the title and description.
Also accepts the props of ViewProps.
PopoverTitle
Heading that labels the panel.
Also accepts the props of React.ComponentProps<typeof PopoverPrimitive.Title>.
PopoverDescription
Secondary text under the title.
Also accepts the props of React.ComponentProps<typeof PopoverPrimitive.Description>.
PopoverContent
Animated panel rendered in a portal and positioned next to the trigger.
| Parameter | Type | Default |
|---|---|---|
width | CGFloat? | 288 |
content | () -> Content | - |
PopoverHeader
Column for the title and description.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
Popover
The root that manages the open state.
| Parameter | Type | Default |
|---|---|---|
open | Boolean | - |
onOpenChange | (Boolean) -> Unit | - |
trigger | @Composable () -> Unit | - |
modifier | Modifier | Modifier |
side | PopupSide | PopupSide.Bottom |
align | PopupAlign | PopupAlign.Center |
sideOffset | Dp | 4.dp |
alignOffset | Dp | 0.dp |
content | @Composable ColumnScope.() -> Unit | - |
PopoverHeader
Column for the title and description.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable ColumnScope.() -> Unit | - |
PopoverTitle
Heading that labels the panel.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
PopoverDescription
Secondary text under the title.
| Parameter | Type | Default |
|---|---|---|
text | String | - |
modifier | Modifier | Modifier |
