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`.', }, }, }, 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. */ 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} ); })}
), };