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.

On this page

Back to All Codemods

Heading Transform

Converts a v6 Heading component to a v7 Heading component.

Automatic Changes

  • Updates the headingStyle prop to the variant or className prop with the following mappings:
    • 'heading1' -> className='heading-1'
    • 'heading2' -> className='heading-2'
    • 'heading3' -> variant='sans-xsmall-bold'
    • 'heading4' -> variant='sans-small-regular'
    • 'heading4g' -> variant='serif-small-regular'
    • 'heading5' -> variant='sans-medium-regular'
    • 'heading5g' -> variant='serif-medium-regular'
    • 'heading6' -> variant='sans-large-book'
    • 'heading6g' -> variant='serif-large-regular'
    • 'heading7g' -> variant='serif-xlarge-regular'
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

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

export default function Page() {

return (

<Heading

level={1}

headingStyle="heading7g"

theme={{ color: 'red' }}

{...otherProps}

>

Heading Text

</Heading>

);

}

Transforms into:

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

export default function Page() {

return (

<Heading level={1} variant="serif-xlarge-regular" {...otherProps}>

Heading Text

</Heading>

);

}

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.