Migrating to v2
v2.0.0 changes one component: NumericBadge.
Codemod: numeric-badge-type-color, run by migrator --from 1.x.y (see Migration guides).
type splits into type and color
type used to mix emphasis and meaning. It now sets emphasis only, and the new color prop sets
meaning:
type:solid | secondary | outlinecolor:neutral | neutral-alt | brand | danger | success | info
The codemod rewrites static type values and adds the matching color. It marks for review a
non-static type, a type that spread props may set or override, and an old type value on a
badge that already has a color.
New defaults
typedefaults tosecondary(it wasprimary). A badge withouttypekeeps the same look, since oldprimarymaps tosecondary+neutral.colordefaults tobrandfortype='solid'and toneutralotherwise.
Other changes
- The badge renders a
data-colorattribute with its color. - A badge with
onClickis now keyboard-accessible: it getsrole="button"andtabIndex={0}. Update tests that look for it by a different role. classNameis now merged with the badge's own classes instead of replacing them.