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 Tab component to a v7 Tab component.
theme prop to the className prop. If it cannot, deletes the theme prop.contentId prop, which has been deprecated.For example:
import { Tab } from '@americanexpress/dls-react6';
export default function Page() {
return (
<Tab contentId="id" theme={{ color: 'red' }} {...otherProps}>
{/** Children */}
</Tab>
);
}
Transforms into:
import { Tab } from '@americanexpress/dls-react';
export default function Page() {
return <Tab {...otherProps}>{/** Children */}</Tab>;
}
id<Tab>aria-labelledby<TabPanel>Previously, we used contentId in <Tab> 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 <Tab> 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>
<Tab id="tab-1" contentId="tab-panel-1">
Tab 1
</Tab>
</TabMenu>
<TabContentGroup>
<TabContent id="tab-panel-1" labelledBy="tab-1">
Tab 1 content
</TabContent>
</TabContentGroup>
</TabGroup>
Transforms into:
<Tabs>
<TabList>
<Tab id="tab-1">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.
Connect with the DLS Team on Slack or by email.
Check out additional resources.