The American Express Design System provides a unified language for designing American Express websites and experiences. The design system provides design resources that match our coded components and are aligned with the American Express brand. Included are colors, components, icons and glyphs, type styles, and graphic assets to get you up and running quickly.
On this page
Converts a v6 Tooltip component to a v7 Tooltip component. Note that this transform exclusively handles migrating the Tooltip component and not the TooltipButton component. The TooltipButton has its own transform for handling the v7 migration separately.
open prop to isOpenforcePlacement prop, which has been deprecatedstatusMessage prop, which has been deprecatedinfo prop, which has been deprecated (see TooltipButton Transform for more information on Info Tooltips)theme prop to the className prop. If it cannot, deletes the theme prop.aria-expanded and aria-labelledby) into a TooltipContent componenttriggerElement prop in a TooltipTrigger componentaria-expanded and aria-labelledby onto the TooltipTrigger componenttriggerElement prop as a child of TooltipFor example:
import { Tooltip } from '@americanexpress/dls-react6';
export default function Page() {
return (
<Tooltip
id="account-tooltip"
triggerElement={
<TooltipButton
info={anyValue}
alternateIconProps={anyValue}
handleTooltipToggle={anyValue}
active={anyValue}
icon={<IconInfo />}
someOtherProp={anyValue}
{...otherProps}
/>
}
placement={placement}
open={open}
info={info}
forcePlacement={anyValue}
statusMessage={anyValue}
aria-expanded={anyValue}
aria-labelledby={anyValue}
theme={{ color: 'red' }}
someOtherProp={anyValue}
{...otherProps}
>
Charles Frost
</Tooltip>
);
}
Transforms into:
import {
Tooltip,
TooltipTrigger,
TooltipContent,
IconButton,
} from '@americanexpress/dls-react';
export default function Page() {
return (
<Tooltip id="account-tooltip" isOpen={isOpen} placement={placement}>
<TooltipTrigger aria-expanded={anyValue} aria-labelledby={anyValue}>
<TooltipButton
info={anyValue}
alternateIconProps={anyValue}
handleTooltipToggle={anyValue}
active={anyValue}
icon={<IconInfo />}
someOtherProp={anyValue}
{...otherProps}
/>
</TooltipTrigger>
<TooltipContent someOtherProp={anyValue} {...otherProps}>
Charles Frost
</TooltipContent>
</Tooltip>
);
}
In v7, we’ve updated the Tooltip component to have consistent and predictable controlled/uncontrolled behavior. See TooltipButton Transform for more information on migrating controlled Tooltip components to the new state management API.
In v7, we’ve built each component from the ground up with accessibility in mind. In order to remain compliant with modern accessibility standards, the trigger for a tooltip must not trigger any action other than opening/closing the tooltip. For more information, see the v7 documentation site.
Connect with the DLS Team on Slack or by email.
Check out additional resources.