import type { Meta, StoryObj } from 'storybook-solidjs-vite';
import { Tooltip } from './tooltip';
import { Button } from './button';
import { componentDescription } from '../stories/docs/element-controls';
const meta = {
title: 'Solid (Advanced)/Primitives/Tooltip',
component: Tooltip,
tags: ['autodocs'],
parameters: {
layout: 'padded',
docs: {
description: componentDescription([
'A small floating label that appears on hover/focus of its trigger element, built with a DIY overlay-core implementation (no third-party dependency, no arrow).',
'**When to use:** to clarify the purpose of icon-only buttons or terse controls — short, supplementary hints that are not essential to complete the action.',
'**How to use:** wrap a single interactive `children` element and set `content` to the hint text. The child becomes the trigger.',
'**Placement:** toolbars, message action rows, and any compact icon control where a label would not otherwise fit.',
]),
controls: { exclude: ['use:eventListener'] },
},
},
argTypes: {
content: {
control: 'text',
description: 'Text shown inside the tooltip bubble.',
},
children: {
control: false,
description: 'The trigger element the tooltip is attached to.',
},
class: {
control: 'text',
description: 'Extra classes applied to the tooltip content bubble.',
},
},
args: {
content: 'This is a tooltip',
children: ,
},
render: (args) => ,
} satisfies Meta;
export default meta;
type Story = StoryObj;
const IMPORT = `import { Tooltip } from '@kitn.ai/chat';`;
const src = (code: string) => ({
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
});
/** Interactive playground — set the tooltip text and hover the trigger. */
export const Playground: Story = {
...src(``),
};
export const OnIconButton: Story = {
render: () => (
),
...src(``),
};