2023-01-10 02:22:04 +00:00
|
|
|
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
2023-08-15 00:42:10 +00:00
|
|
|
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
|
|
|
|
|
|
|
|
import {
|
|
|
|
Examples,
|
|
|
|
Example,
|
|
|
|
Note,
|
|
|
|
Title,
|
|
|
|
CustomArgsTable,
|
|
|
|
VariantsTable,
|
|
|
|
VariantRow,
|
|
|
|
} from "@calcom/storybook/components";
|
|
|
|
|
|
|
|
import Tooltip from "./Tooltip";
|
2023-01-10 02:22:04 +00:00
|
|
|
|
|
|
|
<Meta title="UI/Tooltip" component={Tooltip} />
|
|
|
|
|
2023-08-15 00:42:10 +00:00
|
|
|
<Title title="Tooltip" suffix="Brief" subtitle="Version 2.0 — Last Update: 06 Jan 2023" />
|
2023-01-10 02:22:04 +00:00
|
|
|
|
|
|
|
## Definition
|
2023-08-15 00:42:10 +00:00
|
|
|
|
2023-01-10 02:22:04 +00:00
|
|
|
Tooltip components can be used to provide additional information about an element when the user hovers over or focuses on the element.
|
|
|
|
|
|
|
|
<CustomArgsTable of={Tooltip} />
|
|
|
|
|
|
|
|
<Canvas>
|
2023-08-15 00:42:10 +00:00
|
|
|
<Story
|
|
|
|
name="Tooltip"
|
|
|
|
args={{
|
|
|
|
alertMsg: "Copied!",
|
|
|
|
hoverMsg: "Copy to clipboard",
|
|
|
|
content: "Hover Me",
|
|
|
|
}}
|
|
|
|
argTypes={{
|
|
|
|
alertMsg: {
|
|
|
|
control: {
|
|
|
|
type: "text",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hoverMsg: {
|
|
|
|
control: {
|
|
|
|
type: "text",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
control: {
|
|
|
|
type: "text",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}}>
|
2023-06-23 09:04:26 +00:00
|
|
|
{({ alertMsg, hoverMsg, content }) => (
|
2023-08-15 00:42:10 +00:00
|
|
|
<TooltipProvider>
|
|
|
|
<VariantsTable titles={[""]} columnMinWidth={150}>
|
|
|
|
<VariantRow variant="Default">
|
|
|
|
<Tooltip content={`${hoverMsg}`}>
|
|
|
|
<span
|
|
|
|
className="dark:text-darkgray-50 bg-brand-default dark:bg-darkgray-900 rounded-md p-2 text-gray-100 hover:cursor-pointer"
|
|
|
|
onClick={() => {
|
|
|
|
alert(`${alertMsg}`);
|
|
|
|
}}>
|
|
|
|
{content}
|
|
|
|
</span>
|
|
|
|
</Tooltip>
|
|
|
|
</VariantRow>
|
|
|
|
</VariantsTable>
|
|
|
|
</TooltipProvider>
|
2023-06-23 09:04:26 +00:00
|
|
|
)}
|
2023-01-10 02:22:04 +00:00
|
|
|
</Story>
|
|
|
|
</Canvas>
|