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

Checkbox Transform

Converts a v6 Checkbox component to a v7 Checkbox or CheckboxIndeterminate component.

Automatic Changes

  • Renames the describedBy prop to aria-describedby.
  • Renames disabled to aria-disabled.
  • Renames valid to aria-invalid and inverts the value.
  • Attempts to transform the deprecated theme prop to the className prop. If it cannot, deletes the theme prop.
  • If Checkbox has indeterminate prop, renames component to CheckboxIndeterminate and renames prop to isIndeterminate.

For example:

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

export default function Page() {

return (

<Checkbox

id="some-id"

label="My Checkbox"

disabled={isDisabled}

indeterminate={isIndeterminate}

valid={isValid}

describedBy="some-id"

theme={{ color: 'red' }}

{...otherProps}

/>

);

}

Transforms into:

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

export default function Page() {

return (

<CheckboxIndeterminate

id="some-id"

label="My Checkbox"

aria-disabled={isDisabled}

aria-invalid={!isValid}

aria-describedby="some-id"

isIndeterminate={isIndeterminate}

{...otherProps}

/>

);

}

Manual Changes

Grouped Checkboxes

A new component, CheckboxGroup, was introduced as an accessible and consistent way of grouping a set of Checkbox and CheckboxIndeterminate components. If you are using a group of checkboxes, wrap the checkboxes in a CheckboxGroup instead of a fieldset or similar element.

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.