Added a new example, 'Controlled', for the Tooltip component in the documentation. The 'Controlled' example demonstrates how to use tooltip with controlled states. The change includes the update of examples index and documentation MDX page.
17 lines
469 B
TypeScript
17 lines
469 B
TypeScript
import { Button } from "@components/Button";
|
|
import { Tooltip, TooltipContent } from "@components/Tooltip";
|
|
import { useState } from "react";
|
|
|
|
export function Controlled() {
|
|
const [opened, setOpened] = useState(false);
|
|
|
|
return (
|
|
<Tooltip position="top" controlled opened={opened}>
|
|
<TooltipContent delay={"early"}>
|
|
<p>Tooltip!</p>
|
|
</TooltipContent>
|
|
<Button onClick={() => setOpened((p) => !p)}>Open hover</Button>
|
|
</Tooltip>
|
|
);
|
|
}
|