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

Anchor Transform

Converts a v6 Anchor component to a v7 Link component.

Automatic Changes

  • Renames the import and usages of Anchor to Link.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.

For example:

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

export default function Page() {

return <Anchor {...otherProps}>Some Link</Anchor>;

}

Transforms into:

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

export default function Page() {

return <Link {...otherProps}>Some Link</Link>;

}

  • When Anchor has the btn className, renames the import and usages of Anchor to CallToAction. Will transform className prop to the corresponding variant prop.

For example:

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

export default function Page() {

return (

<>

<Anchor className="btn btn-primary" href="#" {...otherProps}>

Anchor with Button Styles

</Anchor>

<Anchor className="btn btn-secondary" href="#" {...otherProps}>

Anchor with Button Styles

</Anchor>

</>

);

}

Transforms into:

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

export default function Page() {

return (

<>

<CallToAction variant="primary" href="#" {...otherProps}>

Anchor with Button Styles

</CallToAction>

<CallToAction variant="secondary" href="#" {...otherProps}>

Anchor with Button Styles

</CallToAction>

</>

);

}

Manual Changes

Hiding the Icon

By default, non-inline Links now show an icon. To hide the icon, you can set the showIcon prop to false.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.