packages/react-components/react-infolabel/library/docs/Spec.md
Convergence epic issue: #25062
An InfoButton provides a way for users to get more information about a particular UI element. It is a button containing an icon that, when clicked, displays a Popover with the additional information. InfoButton may contain focusable items inside the Popover.
Because the Popover isn't always visible, it should not contain information that people must know in order to complete the field.
| Name | library | Notes |
|---|---|---|
| IconButtonTooltip | Carbon Design System | This is an example within the tooltip component. |
| Tooltip with card appearance and general tooltip | EverGreen | This are examples within the tooltip component. This library doesn't use a button, instead just an icon. |
| Input and guidance to add info button | Salesforce | This component lives within Input and shows how to build an info button instead. |
| TextField with example on how to add an info button | v8 | This is just an example and on how to implement it. |
| ContextualHelp | React Spectrum | It's a full component and uses a Popover instead of tooltip. |
<InfoButton info="This is some additional information." />
See (InfoButton.types.ts)[../src/components/InfoButton/InfoButton.types.ts] for more API details.
Public
<InfoButton
info={
<>
Popover above-start lorem ipsum dolor sit amet consectetur.
<Link href="https://react.fluentui.dev">Learn more</Link>
</>
}
/>
Internal
return (
<slots.popover {...(slotProps.popover as PopoverProps)}>
<PopoverTrigger>
<slots.root {...slotProps.root} />
</PopoverTrigger>
<slots.info {...slotProps.info} />
</slots.popover>
);
DOM
<button type="button" class="fui-InfoButton">
<!-- icon -->
</button>
<!-- on document.body -->
<div role="tooltip" class="fui-PopoverSurface fui-InfoButton__info">
Popover above-start lorem ipsum dolor sit amet consectetur.
<a href="https://react.fluentui.dev">Learn more</a>
</div>
There's no migration guide as v0 and v8 do not have an InfoButton component.
Note: The behavior will change when used in conjunction with the
Fieldcomponent. It is mentioned that when a form has many InfoButtons, it may be better to not make a full tab stop in the button. The idea is to have each field have a "shortcut" that will let you focus on the infobutton. This will be implemented by Field if needed.
Enter or Space key: Opens the Popover.
PopoverSurface and focusable items can be accessed by tabbing.PopoverSurface.Escape key: Closes the Popover.Click: Opens the Popover.Click outside of Popover: Closes the Popover.Tap: Opens the Popover.Tap outside of Popover: Closes the Popover.PopoverSurface and the screen reader announces the content of the PopoverSurface and "note" at the end.PopoverSurfaces's role is note and its tabIndex is set to -1.aria-label is information.Enter or Space should open the Popover.PopoverSurface.PopoverSurface or content within it, pressing Escape should close the Popover.There are two use cases we want to tackle, covering these means covering the 80-90% of use cases:
After considering the options, we've decided to have two controls that will cover these use cases. The first one will be InfoIcon which will cover the first use case and the second one will be InfoButton which will cover the second use case.
To avoid having accessibility issues, we will be providing these controls in the form of InfoIconLabel and InfoButtonLabel. These will provide an out of the box accessibility ready experience.