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

Badge Transform

Converts a v6 Badge component to a v7 Badge component.

Automatic Changes

  • Renames the label prop to screenReaderLabel.

  • Attempts to update the type prop value according to the following mappings. type="outline" and type="outlineFilled" are deprecated and will be converted to type="number".

    • "text" -> "text"
    • "status" -> "status"
    • "number" -> "number"
    • "outline" -> "number"
    • "outlineFilled" -> "number"
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

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

export default function Page() {

return (

<Badge

type="text"

label="Payment approved"

theme={{ color: 'red' }}

{...otherProps}

>

Approved

</Badge>

);

}

Transforms into:

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

export default function Page() {

return (

<Badge type="text" screenReaderLabel="Payment approved" {...otherProps}>

Approved

</Badge>

);

}

Manual Changes

type prop has been updated

The type prop can either be "text" | "status" | "number". The visual appearance for each of these types has been updated. Please make any necessary adjustments.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.