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.

PropTypeDefault
defaultOpenbooleanfalse
delaynumber500
onOpenChange(event: CustomEvent<boolean>) => void—
openbooleanunset
side"top" | "right" | "bottom" | "left""top"

Public classes

ClassPurpose
.ore-tooltip-triggerElement described by the tooltip
.ore-tooltip-contentPopover content
.ore-tooltip-arrowDirectional arrow

CSS variables

VariablePurpose
--ore-tooltip-unitBase size unit
--ore-tooltip-corner-sizeCut corner size
--ore-tooltip-backgroundTooltip background color
--ore-tooltip-borderTooltip and arrow border
--ore-tooltip-foregroundTooltip text color

Accessibility

Tooltip connects its trigger and content with aria-describedby and closes on pointer leave or Esc.

On this page