Bedform UIMessages
Tooltip
Show short hint information.
Tooltip adds a short description to a hovered control.
Tooltip
*
string
*
number
*
Usage
import { Button } from "@bedform/ui/button";
import { Tooltip } from "@bedform/ui/tooltip";
export function CopyWorld() {
return (
<Tooltip side="top">
<Button className="ore-tooltip-trigger" type="button">
Copy
</Button>
<div className="ore-tooltip-content">
Create a copy of this world
<span className="ore-tooltip-arrow" aria-hidden="true" />
</div>
</Tooltip>
);
}The trigger, content and arrow have no components of their own; give them the public classes below.
Placement
Set side to "top", "right", "bottom", or "left". Position updates while the page scrolls or resizes.
Delay
delay is the time in milliseconds before the tooltip opens. Default: 500.
<Tooltip delay={200}>ā¦</Tooltip>Events
oreui:openchange fires after the open state changes. onOpenChange receives it, and its detail is the new boolean state.
API
Tooltip renders a span, accepts every span attribute, and forwards its ref to the span.
| Prop | Type | Default |
|---|---|---|
defaultOpen | boolean | false |
delay | number | 500 |
onOpenChange | (event: CustomEvent<boolean>) => void | ā |
open | boolean | unset |
side | "top" | "right" | "bottom" | "left" | "top" |
Public classes
| Class | Purpose |
|---|---|
.ore-tooltip-trigger | Element described by the tooltip |
.ore-tooltip-content | Popover content |
.ore-tooltip-arrow | Directional arrow |
CSS variables
| Variable | Purpose |
|---|---|
--ore-tooltip-unit | Base size unit |
--ore-tooltip-corner-size | Cut corner size |
--ore-tooltip-background | Tooltip background color |
--ore-tooltip-border | Tooltip and arrow border |
--ore-tooltip-foreground | Tooltip text color |
Accessibility
Tooltip connects its trigger and content with aria-describedby and closes on pointer leave or Esc.