Skip to content
Page

Popover

Floating panel anchored to a trigger.

import { Popover, PopoverTrigger, PopoverContent } from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/PopoverExample.tsx
import { Button, Popover, PopoverContent, PopoverTrigger, Stack, Text } from "@pelagornis/page/components";
export default function PopoverDemo() {
return (
<Popover>
<PopoverTrigger>
<Button variant="outline">Show details</Button>
</PopoverTrigger>
<PopoverContent placement="bottom" align="center">
<Stack gap="sizeXXSmall">
<Text variant="subtitleMd">@pelagornis/page</Text>
<Text variant="bodySm">Re-exports every RefineUI component.</Text>
</Stack>
</PopoverContent>
</Popover>
);
}

Popover is composed from parts that share React state. Children written in MDX are rendered as separate islands, so the parts can’t reach each other. Put the composition in a .tsx file, like the example above, and import that file instead.

src/content/docs/example.mdx
---
title: Example
---
import PopoverExample from "../../components/PopoverExample";
<PopoverExample client:load />

client:load hydrates the island on page load. Use client:visible for content far down the page.

Markdoc tags render Astro components, and this one needs client state. Wrap the example in an .astro file that hydrates it, then register that file as a tag.

src/components/markdoc/PopoverExample.astro
---
import PopoverExample from "../PopoverExample";
---
<PopoverExample client:load />
markdoc.config.mjs
import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";
import starlightMarkdoc from "@astrojs/starlight-markdoc";
import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({
extends: [starlightMarkdoc(), pageMarkdoc()],
tags: {
"popover-example": {
render: component("./src/components/markdoc/PopoverExample.astro"),
selfClosing: true,
},
},
});
src/content/docs/example.mdoc
{% popover-example /%}

Parts of the component and the data-refineui role each one renders.

PartRole
rootpopover-root

Keys the component handles when it has focus.

KeyAction
Escapeclose