summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/tooltip.stories.tsx
blob: efe11d92efb9298bf48b8204fdafdcc1a437a7bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// @ts-nocheck
import * as mod from "./tooltip"
import { create } from "../storybook/scaffold"

const docs = `### Overview
Tooltip for contextual hints and keybind callouts.

Use for short hints; avoid long descriptions.

### API
- Required: \`value\` (tooltip content).
- Optional: \`inactive\`, \`forceOpen\`, placement props from Kobalte.

### Variants and states
- Supports keybind-style tooltip via \`TooltipKeybind\`.

### Behavior
- Opens on hover/focus; can be forced open.

### Accessibility
- TODO: confirm trigger semantics and focus behavior.

### Theming/tokens
- Uses \`data-component="tooltip"\` and related slots.

`

const story = create({ title: "UI/Tooltip", mod, args: { value: "Tooltip", children: "Hover me" } })

export default {
  title: "UI/Tooltip",
  id: "components-tooltip",
  component: story.meta.component,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component: docs,
      },
    },
  },
}

export const Basic = story.Basic

export const Keybind = {
  render: () => (
    <mod.TooltipKeybind title="Search" keybind="Cmd+K">
      <span style={{ "text-decoration": "underline" }}>Hover for keybind</span>
    </mod.TooltipKeybind>
  ),
}

export const ForcedOpen = {
  args: {
    forceOpen: true,
  },
}

export const Inactive = {
  args: {
    inactive: true,
  },
}