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 Collapsible component to a v7 Accordion component.

Automatic Changes

Collapsible Text

  • Renames the import and usages of Collapsible to Accordion.
  • Renames defaultOpen prop to defaultOpenPanelIds.
  • Renames open prop to openPanelIds.
  • Renames onCollapsibleHeadingClick prop to onAccordionToggle.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

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

export default function Page() {

const callback = () => {};

return (

<Collapsible

defaultOpen={['panel-1']}

open={['panel-2']}

onCollapsibleHeadingClick={callback}

{...otherProps}

></Collapsible>

);

}

Transforms into:

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

export default function Page() {

const callback = () => {};

return (

<Accordion

defaultOpenPanelIds={['panel-1']}

openPanelIds={['panel-2']}

onAccordionToggle={callback}

{...otherProps}

></Accordion>

);

}

Manual Changes

Multiple Expanded Panels

Multiple accordion panels can be expanded at the same time. To do so, set shouldAllowMultipleExpanded to true.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.