v5에서 v6로 마이그레이션
v5에서 v6로 마이그레이션 (From v5 to v6)
이 문서는 antd를 5.x에서 6.x로 업그레이드하는 걸 도와줘요. 이번 릴리스는 주로 기술적 업그레이드라서 대부분의 컴포넌트 API는 호환되지만, 업그레이드 전에 환경이 새 요구사항을 충족하는지 확인해야 해요.
출처: 문서
본문
이 문서는 antd를 버전 5.x에서 6.x로 업그레이드하는 데 도움을 줘요. 이번 릴리스는 주로 기술적 업그레이드로, 대부분의 컴포넌트 API는 호환돼요. 다만 업그레이드 전에 환경이 새 요구사항을 충족하는지 확인해야 해요.
CLI로 업그레이드 지원받기 {#use-cli}
체크리스트를 수동으로 훑기 전에 Ant Design CLI로 업그레이드를 지원받는 걸 권장해요. 이 도구는 코드베이스의 deprecated API, 컴포넌트 사용법, 버전 차이를 검사해 주므로 이 문서를 하나하나 읽는 것에만 의존하지 않아도 돼요. 설치와 사용법은 CLI 문서를 참고하세요.
업그레이드 전에
- 먼저 최신 v5 릴리스로 업그레이드하고, 콘솔에 표시된 deprecation 경고를 모두 처리하세요.
- 프로젝트가 React 18 이상에서 돌아가는지 확인하세요 — v6는 React 17 이하를 더 이상 지원하지 않아요.
- v6는 모던 브라우저만 지원하며 기본적으로 CSS 변수를 사용하므로 IE는 지원하지 않아요.
설치:
npm install --save antd@6
# or
yarn add antd@6
# or
pnpm add antd@6
v6의 비호환 변경 사항
React 버전 지원
antd@6는 React >= 18을 요구하며 React 17 이하는 더 이상 지원하지 않아요.- React 19를 지원하려고 넣었던
@ant-design/v5-patch-for-react-19패키지는 더 이상 필요 없어요. 있다면 제거해도 돼요.
- import '@ant-design/v5-patch-for-react-19';
@ant-design/icons 버전 업그레이드
antd@6는@ant-design/icons버전 >= 6.0.0을 요구해요.- ⚠️ 중요:
@ant-design/icons@6는antd@5와 호환되지 않아요. 두 패키지를 반드시 함께 업그레이드하세요. - 프로젝트가
@ant-design/icons에 명시적으로 의존한다면 그것도 v6로 업그레이드해야 해요.
npm install --save @ant-design/icons@6
# or
yarn add @ant-design/icons@6
# or
pnpm add @ant-design/icons@6
업그레이드 중 빌드 오류가 발생하면 @ant-design/icons 버전이 antd 버전과 일치하는지 확인해 보세요.
DOM 조정
- v6는 유지보수성과 일관성을 높이기 위해 많은 컴포넌트의 DOM 구조를 업그레이드하고 최적화해요.
- 표준 antd 스타일링에 의존하는 대부분의 프로젝트에는 영향이 없을 거예요.
- ⚠️ 컴포넌트의 내부 DOM 노드를 겨냥한 커스텀 스타일(예: 특정 선택자나 계층 구조에 의존)이 있다면, 업그레이드 후 해당 스타일을 점검하고 조정해야 할 수 있어요.
API 조정
⚠️ 아래 나열된 API는 deprecated로 표시되었어요. 지금은 여전히 동작하지만 콘솔에 deprecation 경고가 표시되고, 7.0 버전에서 제거될 거예요. 코드의 지속 가능성과 호환성을 위해 가능한 한 빨리 대체 API로 마이그레이션하는 것을 강력히 권장해요.
아래의 모든 deprecation은 별도 표기가 없는 한 v6.0.0부터 적용돼요.
-
AlertcloseText는 deprecated이며closable.closeIcon으로 대체돼요.closeIcon는 deprecated이며closable.closeIcon으로 대체돼요.message는 deprecated이며title로 대체돼요.onClose는 deprecated이며closable.onClose로 대체돼요.afterClose는 deprecated이며closable.afterClose로 대체돼요.
-
AnchorAnchor children은 deprecated이며items로 대체돼요.
-
AutoCompletedropdownMatchSelectWidth는 deprecated이며popupMatchSelectWidth로 대체돼요.dropdownStyle은 deprecated이며styles.popup.root로 대체돼요.dropdownClassName은 deprecated이며classNames.popup.root로 대체돼요.popupClassName은 deprecated이며classNames.popup.root로 대체돼요.dropdownRender는 deprecated이며popupRender로 대체돼요.onDropdownVisibleChange는 deprecated이며onOpenChange로 대체돼요.dataSource는 deprecated이며options로 대체돼요.
-
Avatarsize="default"는 deprecated이며size="medium"으로 대체돼요. (6.3.0)
-
Avatar.GroupmaxCount는 deprecated이며max={{ count: number }}로 대체돼요.maxStyle은 deprecated이며max={{ style: CSSProperties }}로 대체돼요.maxPopoverPlacement은 deprecated이며max={{ popover: PopoverProps }}로 대체돼요.maxPopoverTrigger은 deprecated이며max={{ popover: PopoverProps }}로 대체돼요.
-
BackTopBackTop은 deprecated이며FloatButton.BackTop으로 대체돼요.
-
Badgesize="default"는 deprecated이며size="medium"으로 대체돼요. (6.3.2)
-
Breadcrumbroutes는 deprecated이며items로 대체돼요.Breadcrumb.Item과Breadcrumb.Separator는 deprecated이며items로 대체돼요.breadcrumbName은 deprecated이며title로 대체돼요.items.children은 deprecated이며menu로 대체돼요.
-
Button.GroupButton.Group은 deprecated이며Space.Compact로 대체돼요.
-
ButtoniconPosition은 deprecated이며iconPlacement로 대체돼요.
-
CalendardateFullCellRender는 deprecated이며fullCellRender로 대체돼요.dateCellRender는 deprecated이며cellRender로 대체돼요.monthFullCellRender는 deprecated이며fullCellRender로 대체돼요.monthCellRender는 deprecated이며cellRender로 대체돼요.
-
CardheadStyle은 deprecated이며styles.header로 대체돼요.bodyStyle은 deprecated이며styles.body로 대체돼요.bordered는 deprecated이며variant로 대체돼요.tab은 deprecated이며label로 대체돼요.
-
CarouseldotPosition은 deprecated이며dotPlacement로 대체돼요.
-
CascaderdropdownClassName은 deprecated이며classNames.popup.root로 대체돼요.dropdownStyle은 deprecated이며styles.popup.root로 대체돼요.dropdownRender는 deprecated이며popupRender로 대체돼요.dropdownMenuColumnStyle은 deprecated이며styles.popup.listItem으로 대체돼요.onDropdownVisibleChange는 deprecated이며onOpenChange로 대체돼요.onPopupVisibleChange는 deprecated이며onOpenChange로 대체돼요.bordered는 deprecated이며variant로 대체돼요.showArrow는 deprecated이며 기본 동작이 될 거예요. 숨기려면suffixIcon을null로 설정하세요.
-
CollapsedestroyInactivePanel은 deprecated이며destroyOnHidden으로 대체돼요.expandIconPosition은 deprecated이며expandIconPlacement로 대체돼요.
-
Collapse.Paneldisabled는 deprecated이며collapsible="disabled"로 대체돼요.
-
ConfigProviderdropdownMatchSelectWidth는 deprecated이며popupMatchSelectWidth로 대체돼요.
-
DatePicker.RangePickerdropdownClassName은 deprecated이며classNames.popup.root로 대체돼요.popupClassName은 deprecated이며classNames.popup.root로 대체돼요.popupStyle은 deprecated이며styles.popup.root로 대체돼요.bordered는 deprecated이며variant로 대체돼요.onSelect는 deprecated이며onCalendarChange로 대체돼요.
-
DatePickerdropdownClassName은 deprecated이며classNames.popup.root로 대체돼요.popupClassName은 deprecated이며classNames.popup.root로 대체돼요.popupStyle은 deprecated이며styles.popup.root로 대체돼요.bordered는 deprecated이며variant로 대체돼요.onSelect는 deprecated이며onCalendarChange로 대체돼요.
-
Descriptionschildren은 deprecated이며items로 대체돼요.labelStyle은 deprecated이며styles.label로 대체돼요.contentStyle은 deprecated이며styles.content로 대체돼요.size="default"는 deprecated이며size="large"로 대체돼요. (6.3.2)size="middle"은 deprecated이며size="medium"으로 대체돼요. (6.3.2)
-
Dividertype은 deprecated이며orientation으로 대체돼요.orientationMargin은 deprecated이며styles.content.margin으로 대체돼요.
-
DrawerheaderStyle은 deprecated이며styles.header로 대체돼요.bodyStyle은 deprecated이며styles.body로 대체돼요.footerStyle은 deprecated이며styles.footer로 대체돼요.contentWrapperStyle은 deprecated이며styles.wrapper로 대체돼요.maskStyle은 deprecated이며styles.mask로 대체돼요.drawerStyle은 deprecated이며styles.section으로 대체돼요.classNames.content는 deprecated이며classNames.section으로 대체돼요.styles.content는 deprecated이며styles.section으로 대체돼요.maskClosable은 deprecated이며mask.closable로 대체돼요. (6.3.0)destroyInactivePanel은 deprecated이며destroyOnHidden으로 대체돼요.width는 deprecated이며size로 대체돼요.height는 deprecated이며size로 대체돼요.
-
Dropdown.ButtonDropdown.Button은 deprecated이며Space.Compact + Dropdown + Button으로 대체돼요.
-
DropdowndropdownRender는 deprecated이며popupRender로 대체돼요.destroyPopupOnHide는 deprecated이며destroyOnHidden으로 대체돼요.overlayClassName은 deprecated이며classNames.root로 대체돼요.overlayStyle은 deprecated이며styles.root로 대체돼요.placement: xxxCenter는 deprecated이며placement: xxx로 대체돼요.
-
EmptyimageStyle은 deprecated이며styles.image로 대체돼요.
-
FloatButtondescription은 deprecated이며content로 대체돼요.
-
ImagewrapperStyle은 deprecated이며styles.root로 대체돼요.visible은 deprecated이며open으로 대체돼요.onVisibleChange는 deprecated이며onOpenChange로 대체돼요.maskClassName은 deprecated이며classNames.cover로 대체돼요.rootClassName은 deprecated이며classNames.root로 대체돼요.toolbarRender는 deprecated이며actionsRender로 대체돼요.
-
Input.GroupInput.Group은 deprecated이며Space.Compact로 대체돼요.
-
Inputbordered는 deprecated이며variant로 대체돼요.
-
InputNumberbordered는 deprecated이며variant로 대체돼요.addonAfter는 deprecated이며Space.Compact로 대체돼요.addonBefore는 deprecated이며Space.Compact로 대체돼요.
-
MentionsMentions.Option은 deprecated이며options로 대체돼요.
-
Menuchildren은 deprecated이며items로 대체돼요.
-
ModalbodyStyle은 deprecated이며styles.body로 대체돼요.maskStyle은 deprecated이며styles.mask로 대체돼요.destroyOnClose는 deprecated이며destroyOnHidden으로 대체돼요.maskClosable은 deprecated이며mask.closable로 대체돼요. (6.3.0)focusTriggerAfterClose는 deprecated이며focusable.focusTriggerAfterClose로 대체돼요. (6.2.0)
-
Notificationbtn은 deprecated이며actions로 대체돼요.message는 deprecated이며title로 대체돼요.
-
ProgressstrokeWidth는 deprecated이며size로 대체돼요.width는 deprecated이며size로 대체돼요.trailColor은 deprecated이며railColor로 대체돼요.gapPosition은 deprecated이며gapPlacement로 대체돼요.
-
SelectdropdownMatchSelectWidth는 deprecated이며popupMatchSelectWidth로 대체돼요.dropdownStyle은 deprecated이며styles.popup.root로 대체돼요.dropdownClassName은 deprecated이며classNames.popup.root로 대체돼요.popupClassName은 deprecated이며classNames.popup.root로 대체돼요.dropdownRender는 deprecated이며popupRender로 대체돼요.onDropdownVisibleChange는 deprecated이며onOpenChange로 대체돼요.bordered는 deprecated이며variant로 대체돼요.showArrow는 deprecated이며 기본 동작이 될 거예요. 숨기려면suffixIcon을null로 설정하세요.
-
SlidertooltipPrefixCls는 deprecated이며tooltip.prefixCls로 대체돼요.getTooltipPopupContainer는 deprecated이며tooltip.getPopupContainer로 대체돼요.tipFormatter는 deprecated이며tooltip.formatter로 대체돼요.tooltipPlacement은 deprecated이며tooltip.placement로 대체돼요.tooltipVisible은 deprecated이며tooltip.open으로 대체돼요.onAfterChange는 deprecated이며onChangeComplete로 대체돼요.handleStyle은 deprecated이며styles.handle로 대체돼요.trackStyle은 deprecated이며styles.track으로 대체돼요.railStyle은 deprecated이며styles.rail로 대체돼요.
-
Space.Compactdirection은 deprecated이며orientation으로 대체돼요.
-
Spacedirection은 deprecated이며orientation으로 대체돼요.split은 deprecated이며separator로 대체돼요.
-
Spintip은 deprecated이며description으로 대체돼요. (6.3.0)wrapperClassName은 deprecated이며classNames.root로 대체돼요.size="default"는 deprecated이며size="medium"으로 대체돼요. (6.3.2)
-
Splitterlayout은 deprecated이며orientation으로 대체돼요.
-
Countdown<Statistic.Countdown />는 deprecated이며<Statistic.Timer type="countdown" />으로 대체돼요.
-
StatisticvalueStyle은 deprecated이며styles.content로 대체돼요.
-
StepslabelPlacement은 deprecated이며titlePlacement으로 대체돼요.progressDot은 deprecated이며type="dot"으로 대체돼요.direction은 deprecated이며orientation으로 대체돼요.items.description은 deprecated이며items.content로 대체돼요.size="default"는 deprecated이며size="medium"으로 대체돼요. (6.3.2)
-
Tablepagination.position은 deprecated이며pagination.placement로 대체돼요.onSelectInvert는 deprecated이며onChange로 대체돼요.filterDropdownOpen은 deprecated이며filterDropdownProps.open으로 대체돼요.onFilterDropdownOpenChange는 deprecated이며filterDropdownProps.onOpenChange로 대체돼요.filterCheckall은 deprecated이며locale.filterCheckAll로 대체돼요.onSelectMultiple은 deprecated이며onChange로 대체돼요.onSelectAll은 deprecated이며onChange로 대체돼요.onSelectNone은 deprecated이며onChange로 대체돼요.
-
TabspopupClassName은 deprecated이며classNames.popup으로 대체돼요.tabPosition은 deprecated이며tabPlacement으로 대체돼요.destroyInactiveTabPane은 deprecated이며destroyOnHidden으로 대체돼요.indicatorSize은 deprecated이며indicator={{ size: ... }}로 대체돼요.Tabs.TabPane은 deprecated이며items로 대체돼요.
-
Tagbordered={false}는 deprecated이며variant="filled"으로 대체돼요.color="xxx-inverse"는 deprecated이며variant="solid"으로 대체돼요.
-
TimePickeraddon은 deprecated이며renderExtraFooter로 대체돼요.popupClassName은 deprecated이며classNames.popup으로 대체돼요.popupStyle은 deprecated이며styles.popup으로 대체돼요.
-
TimelineTimeline.Item은 deprecated이며items로 대체돼요.Timeline.Item.position은 deprecated이며placement로 대체돼요.left/right값은start/end로 바꿔야 해요.Timeline.Item.label은 deprecated이며title로 대체돼요.Timeline.Item.children은 deprecated이며content로 대체돼요.Timeline.Item.dot은 deprecated이며icon으로 대체돼요.pending은 deprecated이며items로 대체돼요.pendingDot은 deprecated이며items로 대체돼요.mode=left|right는 deprecated이며mode=start|end로 대체돼요.
-
TooltipoverlayStyle은 deprecated이며styles.root로 대체돼요.overlayInnerStyle은 deprecated이며styles.container로 대체돼요.overlayClassName은 deprecated이며classNames.root로 대체돼요.destroyTooltipOnHide는 deprecated이며destroyOnHidden으로 대체돼요.
-
TransferlistStyle은 deprecated이며styles.section으로 대체돼요.operationStyle은 deprecated이며styles.actions로 대체돼요.operations은 deprecated이며actions로 대체돼요.
-
TreeSelectdropdownMatchSelectWidth는 deprecated이며popupMatchSelectWidth로 대체돼요.dropdownStyle은 deprecated이며styles.popup.root로 대체돼요.dropdownClassName은 deprecated이며classNames.popup.root로 대체돼요.popupClassName은 deprecated이며classNames.popup.root로 대체돼요.dropdownRender는 deprecated이며popupRender로 대체돼요.onDropdownVisibleChange는 deprecated이며onOpenChange로 대체돼요.bordered는 deprecated이며variant로 대체돼요.showArrow는 deprecated이며 기본 동작이 될 거예요. 숨기려면suffixIcon을null로 설정하세요.
오버레이 컴포넌트 (Modal, Drawer 등)
- v6는
mask오버레이 옵션을 도입하고 블러(blur) 효과를 지원해요. - v6.0.0 – v6.2.x는 블러를 기본으로 활성화했지만, v6.3.0부터는 블러가 기본 비활성화예요. 블러를 켜려면:
import { ConfigProvider, Drawer, Modal } from 'antd';
export default () => (
<ConfigProvider
modal={{
mask: {
blur: true,
},
}}
drawer={{
mask: {
blur: true,
},
}}
>
<Modal />
<Drawer />
</ConfigProvider>
);
Tag 여백 조정
v6는 Tag 컴포넌트의 끝에 붙어 있던 기본 여백을 제거했어요 (이전에는 Tag를 가로로 나열하면 마지막 항목에 margin-inline-end 여백이 남았어요). 레이아웃이나 커스텀 스타일이 그 암묵적인 공백에 의존했다면, ConfigProvider의 tag.styles로 다시 넣어 주세요:
import { ConfigProvider, Tag } from 'antd';
export default () => (
<ConfigProvider
tag={{
styles: {
root: {
marginInlineEnd: 8,
},
},
}}
>
<Tag>Tag A</Tag>
<Tag>Tag B</Tag>
<Tag>Tag C</Tag>
</ConfigProvider>
);
특정 영역에서만 예전 여백이 필요하다면, 전역 설정 대신 로컬 컨테이너 오버라이드를 선호하세요. 다른 곳에 의도치 않은 영향이 가지 않도록요.
Form onFinish가 더 이상 Form.List의 모든 데이터를 포함하지 않음
v5에서는 Form.List를 단일 Field로 취급해서, 등록된 Form.Item이 없는 항목까지 onFinish에 Form.List 구조 전체의 데이터가 포함됐어요. v6에서는 Form.List가 등록되지 않은 하위 항목의 데이터를 더 이상 포함하지 않아요. 따라서 이제는 getFieldsValue({ strict: true })로 등록되지 않은 필드를 걸러낼 필요가 없어요.
const onFinish = (values) => {
-- const realValues = getFieldsValue({ strict: true });
++ const realValues = values;
// ...
}
<Form onFinish={onFinish} />
size enum 통일 (6.3.0 – 6.3.2) {#size-enum-unify}
v6는 컴포넌트 size enum을 점진적으로 'large' | 'medium' | 'small'로 통일했어요. 예전 값도 여전히 동작하지만 deprecation 경고가 나오고 v7에서 제거될 거예요.
Avatar,Badge,Card,Progress,Steps,Switch,Spin:size는 이제default대신medium을 사용해요.Descriptions:size는 이제middle대신medium,default대신large를 사용해요.Table,Divider:size는 이제middle대신medium을 사용해요.
- <Switch size="default" />
+ <Switch size="medium" />
- <Descriptions size="default" />
+ <Descriptions size="large" />
- <Descriptions size="middle" />
+ <Descriptions size="medium" />
- <Table size="middle" />
+ <Table size="medium" />
Splitter collapsibleIcon deprecated (6.4.0) {#splitter-collapsible-icon}
Splitter의collapsibleIcon은 deprecated이며collapsible.icon으로 대체돼요.
브라우저 지원 변경
- CSS 변수가 기본으로 활성화되고 모던 브라우저만 지원해요.
- IE는 더 이상 지원하지 않아요. 일부 오래된 국내 브라우저에서는 호환성 문제가 있을 수 있으니, 배포 전에 타깃 브라우저를 꼭 확인하세요.
원자적 마이그레이션: 패키지 별칭으로 v6 설치
- 마이그레이션의 영향을 제한하고 싶다면 원자적 마이그레이션을 시도할 수 있어요. 다만 이는 권장되는 업그레이드 경로가 아님을 알아 두세요.
업그레이드 체크리스트
v6로 업그레이드한 뒤 애플리케이션이 올바르게 동작하는지 다음 체크리스트를 확인해 보세요:
- React 버전: 앱이 React >= 18을 사용하고
@ant-design/v5-patch-for-react-19를 제거했는지 확인하세요. - @ant-design/icons 버전:
@ant-design/icons가antd@6에 맞게 >= 6.0.0으로 업그레이드되었는지 확인하세요. - 브라우저 호환성: 타깃 사용자 브라우저가 모던하고 CSS 변수를 지원하는지 확인하세요.
- 커스텀 스타일: 컴포넌트 내부 DOM 노드를 겨냥한 CSS가 있다면 v6에서도 동작하는지 확인하고 필요하면 조정하세요.
- 오버레이 마스크 설정: Modal, Drawer 등이 마스크 블러를 끌 필요가 있는지 결정하고, 필요 없으면 기본값을 두세요.
- 빌드 설정: 빌드가 오류 없이 완료되고 CSS 변수 / CSS-in-JS가 올바르게 동작하는지 확인하세요.
- 콘솔 경고: 앱을 실행하고 콘솔에 표시되는 레거시 API 경고를 해결하세요.
도움이 필요하세요?
업그레이드 중 문제가 생기면 https://new-issue.ant.design/ 에 이슈를 열어 주세요. 가능한 한 빨리 답변하고 문서도 개선할게요.