InfoButton
A button with the info glyph that shows info in a note next to it: text, links or other rich content, placed above the button with a beak (a toggletip).
- **Naming.** The button is named "Information" (aria-label, which localizes it). Next to a heading or other text, pass aria-labelledby with that text's id and the button's own id: the button is then named "‹text› Information", so several info buttons on a page are told apart. The note (role="note") is labelled like the button: by the same aria-labelledby ids, else by the button. The button has aria-expanded, and aria-controls while the note is open, but no aria-haspopup: a note is none of the popup kinds it names.
- **Opening.** A click pins the note open, and a click on a pinned note closes it. With openOnHover (the default) a mouse pointer resting on the button opens it after 250 ms, and it closes 250 ms after the pointer has left the button and the note (a pointer moving diagonally from the button into the note keeps it open; touch and pen never hover); keyboard focus on the button opens it too, while focus that comes from a pointer press waits for the click. A hover close moves no focus, and a note that keyboard focus opened or keeps never closes because of pointer movement. Opening never moves focus. Escape, a press outside and focus moving outside the button and the note close it; Escape returns focus to the button when it was in the note, and a dismissed note opens again on keyboard focus only once focus has left both.
- **Tab path.** The note is portaled, but it keeps its place right after the button in the keyboard order: Tab from the open button enters the note's first element (a link in it), Tab past its last element continues after the button, and Shift+Tab from its first element returns to the button.
- **One copy of info.** While the note is closed, info renders next to the button in an element that is not displayed and describes the button (aria-describedby), so it is in the server HTML and is read when the button takes focus. While the note is shown, info renders only inside it, in an unnamed element that describes the button. info is never in the document twice, so content with ids or effects is safe; it remounts each time the note opens and closes, so state inside it starts over and its effects run again.
- **Structure.** The button is the root element: ref, className, style and every other attribute go to it, the consumer's handlers first. The description and the note render next to it, never inside it. Its box is 24×24px at every size and renders data-size. The note mounts through the presence core: it carries data-presence, data-state (open, and closed while it exits, inert) and the data-wave-infolabel-surface marker.
- **Motion.** The note fades in and slides toward the button from the side it is placed on (data-side, after a flip: it enters once it has its position, data-presence="exited" and transparent until then), and fades out and slides back as it closes (see motion); it stays in the document, inert, until the exit ends, with info still inside it (never twice in the document), while the dismiss layer, the focus restore and the button's aria-expanded follow the open state at once. Focus inside a closing note moves to the button in the closing commit. Without motion (reduced motion, motion={null}, or a provider with motion="none") it unmounts as soon as it closes.
Fluent's InfoButton takes the same info and size. It opens on click only (openOnHover={false} here), renders its note in place, and moves focus into the note; this one keeps focus on the button and renders the note in a portal. Fluent's popover props and a controlled open state are not offered.
Examples
Next To A Heading
Billing
Charges appear on the first of the month.export const NextToAHeading: Story = {
render: (args) => (
<div className="flex items-center gap-1">
<h2 id="billing-heading" className="text-wave-subtitle-2">
Billing
</h2>
<InfoButton
{...args}
id="billing-info"
aria-labelledby="billing-heading billing-info"
info="Charges appear on the first of the month."
/>
</div>
),
};Motion
export const Motion: Story = {
render: (args) => (
<div className="flex flex-col gap-3">
{motionCases(fadeAndZoom).map(({ label, motion }, index) => (
<div key={label} className="flex items-center gap-1">
<span id={`motion-label-${index}`} className="text-wave-body-1">
{label}
</span>
{/* The story renders one button per case; every other arg is forwarded. */}
<InfoButton
{...args}
id={`motion-info-${index}`}
aria-labelledby={`motion-label-${index} motion-info-${index}`}
motion={motion}
/>
</div>
))}
</div>
),
};Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
info | React.ReactNode | Yes | The information the note shows: text, links or other content. It also describes the button ( | |
size | 'small' | 'medium' | 'large' | No | 'medium' | Size of the glyph: 12, 16 or 20px. The button box stays 24×24px at every size, with negative margins above and below, so it never makes a row that centres its items (as InfoLabel does) taller. |
openOnHover | boolean | No | true | Open the note when a mouse pointer rests on the button (after 250 ms; it closes 250 ms after the pointer has left the button and the note, touch and pen never hover), and when the button receives keyboard focus. |
aria-label | string | No | 'Information' | Accessible name of the button, and of the note, which is labelled like the button. Localize it here. With |
motion | MotionSlot | null | No | the fade and slide above | The note's motion. By default it fades in and slides 4px away from the button, on the side it opened on, over 200 ms with a decelerating curve, and fades out and slides back over 100 ms with an accelerating curve; under reduced motion it appears and disappears at once. |
ref | React.Ref<HTMLButtonElement> | No | Ref to the button. | |
slotProps | { info?: SlotPart<'div'>; beak?: SlotPart<'div'> } | No | Props for the elements the InfoButton draws besides the button, by part, merged into each part's own: your classes after the part's (yours win a conflict), your styles over its styles, your attributes and handlers added, your ref beside its ref. Every attribute the InfoButton sets on a part is locked and keeps its value; you add the attributes it does not set. A part takes no |
Any other prop is passed to the element it renders (HTMLButtonElement).
Parts
infobeak
Stable class names
| Part | Class |
|---|---|
root | wave-info-button |
info | wave-info-button__info |
beak | wave-info-button__beak |