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 CollapsibleHeading to a v7 AccordionText component.
CollapsibleHeading to AccordionText.theme prop to the className prop. If it cannot, deletes the theme prop.forId prop. Use the id prop instead.labels.collapsed prop to labelOverrides.collapsedLabel.labels.expanded prop to labelOverrides.expandedLabel.defaultBtn to shouldUseUnstyledButton.children if shouldUseUnstyledButton is false.labelOverrides if shouldUseUnstyledButton is true.For example:
import { CollapsibleHeading } from '@americanexpress/dls-react6';
export default function Page() {
return (
<CollapsibleHeading
forId="panel-1"
labels={{
expanded: 'Hide Details',
collapsed: 'Show Details',
}}
{...otherProps}
>
Show Details
</CollapsibleHeading>
);
}
Transforms into:
import { AccordionText } from '@americanexpress/dls-react';
export default function Page() {
return (
<AccordionText
id="panel-1"
labelOverrides={{
expandedLabel: 'Hide Details',
collapsedLabel: 'Show Details',
}}
{...otherProps}
/>
);
}
And:
import { CollapsibleHeading } from '@americanexpress/dls-react6';
export default function Page() {
return (
<CollapsibleHeading
forId="panel-1"
labels={{
expanded: 'Hide Details',
collapsed: 'Show Details',
}}
defaultBtn={true}
{...otherProps}
>
Show Details
</CollapsibleHeading>
);
}
Transforms into:
import { AccordionText } from '@americanexpress/dls-react';
export default function Page() {
return (
<AccordionText
id="panel-1"
labels={{
expanded: 'Hide Details',
collapsed: 'Show Details',
}}
isDefaultBtn={true}
{...otherProps}
>
Show Details
</AccordionText>
);
}
The text or content that is displayed above the trigger element can be passed to the AccordionText using the heading prop.
Connect with the DLS Team on Slack or by email.
Check out additional resources.