diff --git a/packages/design-system-react/MIGRATION.md b/packages/design-system-react/MIGRATION.md index e2c205a1d..598876219 100644 --- a/packages/design-system-react/MIGRATION.md +++ b/packages/design-system-react/MIGRATION.md @@ -7,6 +7,7 @@ This guide provides detailed instructions for migrating your project from one ve - [General Extension Migration Guidance](#general-extension-migration-guidance) - [From Extension Component Library](#from-extension-component-library) - [Button Component](#button-component) + - [ButtonBase Component](#buttonbase-component) - [ButtonIcon Component](#buttonicon-component) - [Box Component](#box-component) - [BannerAlert Component](#banneralert-component) @@ -141,6 +142,156 @@ The design system Button adds these props: - `loadingText` — custom text during loading state - `className` — Tailwind utility class overrides (merged via `twMerge`) +### ButtonBase Component + +`ButtonBase` is a low-level building block for styled buttons. It has significant API changes from the extension `component-library` version — most notably, polymorphism via `as`/`href` is replaced by the `asChild` composition pattern, and `Box`/`TextStyleUtilityProps` are no longer accepted. + +#### Breaking Changes + +##### Import Path + +| Extension Pattern | Design System Migration | +| ---------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `import { ButtonBase } from '../../component-library'` | `import { ButtonBase } from '@metamask/design-system-react'` | +| `import { ButtonBaseSize } from '../../component-library'` | `import { ButtonBaseSize } from '@metamask/design-system-react'` | +| `import type { ButtonBaseProps } from '../../component-library'` | `import type { ButtonBaseProps } from '@metamask/design-system-react'` | + +##### Size Enum + +`ButtonBaseSize` keeps the same values, but the default changes from `Md` to `Lg`. + +| Extension Value | Design System Value | Notes | +| ---------------------------- | ---------------------------- | -------------------------------- | +| `ButtonBaseSize.Sm` (`'sm'`) | `ButtonBaseSize.Sm` (`'sm'`) | unchanged | +| `ButtonBaseSize.Md` (`'md'`) | `ButtonBaseSize.Md` (`'md'`) | unchanged; no longer the default | +| `ButtonBaseSize.Lg` (`'lg'`) | `ButtonBaseSize.Lg` (`'lg'`) | unchanged; **new default** | + +##### State Props Renamed + +| Extension Prop | Design System Prop | Notes | +| ------------------ | ------------------ | ------- | +| `disabled` | `isDisabled` | renamed | +| `loading` | `isLoading` | renamed | +| `block` | `isFullWidth` | renamed | +| `iconLoadingProps` | `loadingIconProps` | renamed | + +##### Content Model + +`ButtonBase` already uses `children` in the extension — no change. String children are wrapped in a `Text` component automatically; non-string children are rendered as-is. + +##### Polymorphism Removed: `as` / `href` → `asChild` + +The extension `ButtonBase` is polymorphic — `as` switches the root element between `button` and `a`, and an `href` prop auto-switches to `a`. The design system `ButtonBase` always renders a `