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 IconTab component to a v7 Tab component.
theme prop to the className prop. If it cannot, deletes the theme prop.IconTab to Tab.contentId prop, which has been deprecated.For example:
import { IconTab } from '@americanexpress/dls-react6';
import { IconPlane } from '@americanexpress/dls-icons';
export default function Page() {
return (
<IconTab
contentId="id"
icon={<IconPlane />}
theme={{ color: 'red' }}
{...otherProps}
>
{/** Children */}
</IconTab>
);
}
Transforms into:
import { Tab } from '@americanexpress/dls-react';
import { IconPlane } from '@americanexpress/dls-icons';
export default function Page() {
return (
<Tab icon={<IconPlane />} {...otherProps}>
{/** Children */}
</Tab>
);
}
id<IconTab>aria-labelledby<TabPanel>Previously, we used contentId in <IconTab> to associate the tab with the panel. In v7, the id prop in <Tab> is passed to the aria-labelledby prop in <TabPanel> to indicate which panel the tab controls. This pattern is more familiar and follows the accessibility patterns found in our other components.
Most likely, the <TabContent> component transform automatically makes this change, assuming that the same string was passed to the id prop of <IconTab> and the labelledBy prop of <TabContent>. If not, you will need to manually update the props as stated above. Please refer to the TabContent transform for more information.
For example:
<TabGroup>
<TabMenu>
<IconTab id="tab-1" contentId="tab-panel-1" icon={<IconPlane />}>
Tab 1
</IconTab>
</TabMenu>
<TabContentGroup>
<TabContent id="tab-panel-1" labelledBy="tab-1">
Tab 1 content
</TabContent>
</TabContentGroup>
</TabGroup>
Transforms into:
<Tabs>
<TabList>
<Tab id="tab-1" icon={<IconPlane />}>
Tab 1
</Tab>
</TabList>
<TabPanel id="tab-panel-1" aria-labelledby="tab-1">
Tab 1 content
</TabPanel>
</Tabs>
Note: The code example shows other Tab components being transformed for the sake of accuracy. Please refer to the TabGroup, TabMenu, TabContent transforms for more information.
iconPreviously, the icon was always placed on top of the text in the tab. The default placement in v7 is still the top. However, you can change the placement of the icon to the start of the text by using the iconPlacement prop in the Tab component.
Connect with the DLS Team on Slack or by email.
Check out additional resources.