Files
shadcn-ui/apps/www/content/docs/components/popover.mdx
2023-04-17 19:19:40 +04:00

61 lines
1.2 KiB
Plaintext

---
title: Popover
description: Displays rich content in a portal, triggered by a button.
component: true
radix:
link: https://www.radix-ui.com/docs/primitives/components/popover
api: https://www.radix-ui.com/docs/primitives/components/popover#api-reference
---
<ComponentExample src="/components/examples/popover/demo.tsx">
<PopoverDemo />
</ComponentExample>
## Installation
```bash
npx shadcn-ui add popover
```
<Accordion type="single" collapsible>
<AccordionItem value="manual-installation">
<AccordionTrigger>Manual Installation</AccordionTrigger>
<AccordionContent>
1. Install the `@radix-ui/react-popover` component from radix-ui:
```bash
npm install @radix-ui/react-popover
```
2. Copy and paste the following code into your project.
<ComponentSource src="/components/ui/popover.tsx" />
<Callout>
This is the `<Popover />` primitive. You can place it in a file at
`components/ui/popover.tsx`.
</Callout>
</AccordionContent>
</AccordionItem>
</Accordion>
## Usage
```tsx
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
```
```tsx
<Popover>
<PopoverTrigger>Open</PopoverTrigger>
<PopoverContent>Place content for the popover here.</PopoverContent>
</Popover>
```