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

Tag Transform

Converts a v6 Tag component to a v7 Tag component.

Automatic Changes

  • Renames the dismissible prop to isDismissible.
  • Renames the onDismiss prop to onClick.
  • Renames the label prop to labelOverrides.dismissScreenReaderLabel.
  • Removes the inline prop, which has been deprecated.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

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

export default function Page() {

return (

<Tag

inline={inline}

dismissible={dismissible}

label="Click to dismiss"

onDismiss={onDismiss}

theme={{ color: 'red' }}

{...otherProps}

>

Tag Text

</Tag>

);

}

Transforms into:

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

export default function Page() {

return (

<Tag

isDismissible={dismissible}

onClick={onDismiss}

{...otherProps}

labelOverrides={{

dismissScreenReaderLabel: 'Click to dismiss',

}}

>

Tag Text

</Tag>

);

}

Manual Changes

Toggle Behavior

Note that in v7, the default Tag component (in other words, if isDismissible={false}) can be toggled. Please verify that this behavior works within the context of your application.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.