import type { Meta, StoryObj } from '@storybook/react-vite'; import { BoldIcon, ItalicIcon, UnderlineIcon } from 'lucide-react'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip'; import { Button } from '../button/button'; const meta = { title: 'Components/Tooltip', component: Tooltip, parameters: { layout: 'centered', docs: { description: { component: 'Short hint on hover or keyboard focus. Never put essential information or interactive content in one — it is unreachable on touch devices. Icon-only buttons still need their own `aria-label`.\n\nCBAR only draws the `bottom` placement, so the other three sides are the kit mirroring it. `showArrow` turns the pointer off for triggers the bubble already sits against.', }, }, }, tags: ['autodocs'], decorators: [(Story) => ], } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { render: () => ( Adds the item to your library ), }; /** The label names the button; the tooltip only repeats it visually. */ /** Without the pointer, for triggers the bubble already sits flush against. */ export const WithoutArrow: Story = { render: () => ( Saves without closing ), }; export const IconToolbar: Story = { render: () => (
{[ [BoldIcon, 'Bold', '⌘B'], [ItalicIcon, 'Italic', '⌘I'], [UnderlineIcon, 'Underline', '⌘U'], ].map(([Icon, label, shortcut]) => { const IconComponent = Icon as typeof BoldIcon; return ( {label as string} {shortcut as string} ); })}
), };