Tooltips are floating labels that briefly explain the function of a user interface element. They must be specified inside the `overlay` prop of an activator component. Currently, activator components are `Button`, `Link`, and `Pressable`. The library takes care of applying the WAI-ARIA Tooltip Widget pattern automatically for the activator and the tooltip content. Expect screen readers to read the tooltip content when the user focuses the activator.
import {
render,
Icon,
Pressable,
Tooltip,
} from '@shopify/checkout-ui-extensions-react';
render('Checkout::Dynamic::Render', () => );
function Extension() {
return (
In case we need to contact you about your order
}
>
);
}
import {
extend,
Icon,
Pressable,
Tooltip,
} from '@shopify/checkout-ui-extensions';
extend('Checkout::Dynamic::Render', (root) => {
const tooltipFragment = root.createFragment();
const tooltip = root.createComponent(
Tooltip,
{},
'In case we need to contact you about your order',
);
tooltipFragment.appendChild(tooltip);
const pressable = root.createComponent(
Pressable,
{overlay: tooltipFragment},
[root.createComponent(Icon, {source: 'questionFill'})],
);
root.appendChild(pressable);
});
A unique identifier for the component.