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 TooltipButton component to an equivalent v7 component.
alternateIconProps prop, which has been deprecated (see Manual Changes)handleTooltipToggle prop, which has been deprecated (see Manual Changes)active prop, which has been deprecated (see Manual Changes)info prop, which has been deprecated. InfoTooltips will be automatically converted to the new API (see sections below).theme prop to the className prop. If it cannot, deletes the theme prop.title prop on the icon supplied in the icon prop to the screenReaderLabel prop on the new components (see sections below).iconIconInfoGlyphInfoTooltipButton to InfoTooltipButtonicon prop, which has been deprecated since an info icon is rendered alreadyFor example:
import { TooltipButton } from '@americanexpress/dls-react6';
export default function Page() {
return (
<TooltipButton
info={anyValue}
alternateIconProps={anyValue}
handleTooltipToggle={anyValue}
active={anyValue}
icon={<IconInfo title="More Info" />}
someOtherProp={anyValue}
{...otherProps}
/>
);
}
Transforms into:
import { InfoTooltipButton } from '@americanexpress/dls-react';
export default function Page() {
return (
<InfoTooltipButton
screenReaderLabel="More Info"
someOtherProp={anyValue}
{...otherProps}
/>
);
}
iconTooltipButton to IconButtonicon prop as children of the IconButtonFor example:
import { TooltipButton } from '@americanexpress/dls-react6';
export default function Page() {
return (
<TooltipButton
info={anyValue}
alternateIconProps={anyValue}
handleTooltipToggle={anyValue}
active={anyValue}
icon={<IconAccount title="Additional Account Information" />}
someOtherProp={anyValue}
{...otherProps}
/>
);
}
Transforms into:
import { TooltipTrigger, IconButton } from '@americanexpress/dls-react';
export default function Page() {
return (
<IconButton
screenReaderLabel="Additional Account Information"
someOtherProp={anyValue}
{...otherProps}
>
<IconAccount />
</IconButton>
);
}
alternateIconProps has been deprecatedPreviously, this prop allowed additional props to be added to the icon when active. In v7, we’ve reworked the state management of the Tooltip component to be consistent with the rest of our system. If you’re using the tooltip as an info tooltip, we’d recommend throwing away this prop entirely. We’ve rebuilt the trigger for an info tooltip into it’s own dedicated component, so that it can be consistent across all products at Amex. If you’re not using the tooltip as an info tooltip, we’d recommend controlling the state of the v7 Tooltip component, and then conditionally applying props to the icon you’ve chosen. See the documentation for the v7 Tooltip component for more information.
handleTooltipToggleactiveIn v7, we’ve reworked the state management of the Tooltip component to be consistent with the rest of our system. The API for handling the open/closed states of the tooltip have been migrated to a wrapper component. As a result, these props are no longer supported.
The following is an example of controlling the open state of the v6 Tooltip using active and handleTooltipToggle:
() => {
const [isOpen, setIsOpen] = useState(false);
const handleTooltipToggle = (event) => {
setIsOpen(!isOpen);
};
return (
<Tooltip
id="tooltip"
open={isOpen}
info={true}
triggerElement={
<TooltipButton
handleTooltipToggle={handleTooltipToggle}
active={isOpen}
>
<GlyphInfo />
</TooltipButton>
}
>
Some Content
</Tooltip>
);
};
The equivalent v7 code should look like the following:
() => {
const [isOpen, setIsOpen] = useState(false);
const handleTooltipToggle = (newOpen) => {
setIsOpen(newOpen);
};
return (
<Tooltip id="tooltip" isOpen={isOpen} onIsOpenChange={handleTooltipToggle}>
<TooltipTrigger>
<InfoTooltipButton />
</TooltipTrigger>
<TooltipContent>Some Content</TooltipContent>
</Tooltip>
);
};
Connect with the DLS Team on Slack or by email.
Check out additional resources.