DocsComponentsTemplatesThemesGitHub

Popover

Floating panel anchored to a trigger for rich, interactive content.

Code

import * as React from 'react';
import { Button, Popover, Switch } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        minHeight: 220,
      }}
    >
      <Popover
        defaultOpen
        label="Notifications"
        trigger={
          <Button variant="gray" icon="bell">
            Notify
          </Button>
        }
      >
        <div
          style={{
            display: 'flex',
            flexDirection: 'column',
            gap: 12,
          }}
        >
          <b>Notifications</b>
          <Switch label="Email me" showLabel defaultChecked />
          <Switch label="Push" showLabel />
        </div>
      </Popover>
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { Popover } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/popover.json

Guidelines

  • Closes on outside click and Esc. Keep it under ~320px wide.

Props

PropTypeRequired
triggerReact.ReactElementYes
openbooleanNo
defaultOpenbooleanNo
onOpenChange(open: boolean) => voidNo
align'start' | 'end'No
widthnumberNo
labelstringNo
classNamestringNo
childrenReact.ReactNodeNo

Edit this example on GitHub