Tip
Tip is a component that displays supplementary information with a built-in icon trigger.
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" />
</HStack>
Usage
import { Tip } from "@yamada-ui/react"
import { Tip } from "@/components/ui"
import { Tip } from "@workspaces/ui"
<Tip />
Change Status
To change the status, set status to "help", "info", etc. The default is "help".
<VStack>
<For each={["help", "info", "success", "warning", "error"]}>
{(status) => (
<HStack key={status} gap="xs">
<Text as="span" whiteSpace="nowrap">
{toTitleCase(status)}
</Text>
<Tip content="俺は俺の責務を全うする!!" status={status} />
</HStack>
)}
</For>
</VStack>
Change Color Scheme
<VStack>
<For each={["help", "info", "success", "warning", "error"]}>
{(status) => (
<HStack key={status} gap="xs">
<Text as="span" whiteSpace="nowrap">
{toTitleCase(status)}
</Text>
<Tip
colorScheme={status === "help" ? "mono" : status}
content="俺は俺の責務を全うする!!"
status={status}
/>
</HStack>
)}
</For>
</VStack>
Change Duration
To change the duration, set duration to a number (seconds).
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" duration={0.7} />
</HStack>
Add Delay
To delay showing or hiding, set openDelay or closeDelay to a number (milliseconds).
<VStack>
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
Delay Open 1000ms
</Text>
<Tip content="俺は俺の責務を全うする!!" openDelay={1000} />
</HStack>
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
Delay Close 1000ms
</Text>
<Tip content="俺は俺の責務を全うする!!" closeDelay={1000} />
</HStack>
</VStack>
Change Offset
To change the offset, set gutter or offset values.
gutter sets the simple distance from the element, and offset sets [horizontal, vertical].
<VStack>
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" gutter={32} />
</HStack>
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" offset={[16, 16]} />
</HStack>
</VStack>
Change Animation
To change the show or hide animation, set animationScheme to "scale", "block-end", etc. The default is "scale".
<VStack>
<For
each={["scale", "block-end", "inline-start", "inline-end", "block-start"]}
>
{(animationScheme) => (
<HStack key={animationScheme} gap="xs">
<Text as="span" whiteSpace="nowrap">
{toTitleCase(animationScheme)}
</Text>
<Tip
animationScheme={animationScheme}
content="俺は俺の責務を全うする!!"
/>
</HStack>
)}
</For>
</VStack>
Change Placement
To change the placement, set placement to "end", "center-start", etc. The default is "start".
<VStack>
<For
each={[
"start",
"start-start",
"start-end",
"start-center",
"end",
"end-start",
"end-end",
"end-center",
"center-start",
"center-end",
]}
>
{(placement) => (
<HStack key={placement} gap="xs">
<Text as="span" whiteSpace="nowrap">
{toTitleCase(placement)}
</Text>
<Tip content="俺は俺の責務を全うする!!" placement={placement} />
</HStack>
)}
</For>
</VStack>
Disable
To disable the tooltip, set disabled to true.
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" disabled />
</HStack>
Always Open
To always show the tooltip, set open to true.
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" open />
</HStack>
Customize Icon
To customize the icon, set icon to an icon element.
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip content="俺は俺の責務を全うする!!" icon={<MessageCircleWarningIcon />} />
</HStack>
Control
const { open, onClose, onOpen } = useDisclosure()
return (
<HStack gap="xs">
<Text as="span" whiteSpace="nowrap">
煉獄杏寿郎
</Text>
<Tip
content="俺は俺の責務を全うする!!"
open={open}
onClose={onClose}
onOpen={onOpen}
/>
</HStack>
)
"use client" to the top of the file.