import type { Meta, StoryObj } from '@storybook/react-vite' import { Bell, CalendarDays, Link2, SlidersHorizontal } from 'lucide-react' import { useState } from 'react' import { fn } from 'storybook/test' import { Button, IconButton } from './Button' import { Input } from './Input' import { Popover } from './Popover' import { POPUP_ALIGNS, POPUP_SIDES } from './popover.tokens' const ownFrame = (height = 420) => ({ docs: { story: { inline: false, iframeHeight: height } } }) const meta = { title: 'Overlays/Popover', component: Popover, tags: ['autodocs'], parameters: { docs: { description: { component: 'Interactive content anchored to a trigger, on Base UI Popover. Opens on click, flips to stay on screen, and closes on Escape or an outside click with focus returning to the trigger. Use it for small forms, filters and details; for short non-interactive hints use Tooltip.', }, }, }, argTypes: { title: { control: 'text' }, description: { control: 'text' }, label: { control: 'text' }, side: { control: 'inline-radio', options: POPUP_SIDES, table: { defaultValue: { summary: 'bottom' } } }, align: { control: 'inline-radio', options: POPUP_ALIGNS, table: { defaultValue: { summary: 'center' } } }, sideOffset: { control: { type: 'number', min: 0, max: 32 }, table: { defaultValue: { summary: '8' } } }, arrow: { control: 'boolean' }, width: { control: 'number', table: { defaultValue: { summary: '320' } } }, open: { control: 'boolean' }, defaultOpen: { control: 'boolean' }, modal: { control: 'boolean' }, className: { control: 'text' }, trigger: { control: false }, children: { control: false }, onOpenChange: { control: false }, }, args: { title: 'Notifications', description: 'You’re all caught up.', side: 'bottom', align: 'center', sideOffset: 8, arrow: false, width: 320, trigger: ( }> Notifications ), onOpenChange: fn(), }, decorators: [ (Story) => (
Placed on the {side}.
Lines up with the trigger’s {align}.