Codemods

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.

Back to All Codemods

Collapsible Transform

Converts a v6 CollapsiblePanel component to a v7 AccordionPanel component.

Automatic Changes

Collapsible Panel

  • Renames the import and usages of CollapsiblePanel to AccordionPanel.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.
  • Moves children into a heading element and places that in the heading prop.
  • Deletes the headingLevel prop. Use the heading prop instead.

For example:

import { CollapsiblePanel } from '@americanexpress/dls-react6';

export default function Page() {

return (

<CollapsiblePanel id="collapsible-p-h1" icon={<IconHotel />} {...otherProps}>

Hotel

</CollapsiblePanel>

)

Transforms into:

import { AccordionPanel } from '@americanexpress/dls-react';

export default function Page() {

return (

<AccordionPanel

id="collapsible-p-h1"

icon={<IconHotel />}

heading={<h3>Hotel</h3>}

{...otherProps}

/>

);

}

Manual Changes

Heading and Subtext

Use the heading prop to pass a heading element directly to the AccordionPanel. Use the subtext prop for any additional information displayed below.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.