packages/codemods/v5-0-0/05-simple-prop-renames.md
Several blocks have properties and events renamed in antd v6. These are direct renames with no value changes (except where noted).
Apply these renames in all YAML files:
| Block | Old Name | New Name | Type |
|---|---|---|---|
| Modal | visible | open | Property |
| Tooltip | defaultVisible | defaultOpen | Property |
| Tooltip | onVisibleChange | onOpenChange | Event |
| Progress | gapPosition | gapPlacement | Property |
| Carousel | dotPosition | dotPlacement | Property |
| Collapse | expandIconPosition | expandIconPlacement | Property |
visibleThe visible key is also used at the block level (all blocks have a visible: property for conditional rendering). Only rename visible that is inside a Modal block's properties: section — not the block-level visible:.
How to distinguish:
visible: is at the same indent as type:, properties:, events:visible: is nested under properties: (indented 2 more spaces)type: is ModalGlob: **/*.{yaml,yml}
Grep: visible:|defaultVisible:|onVisibleChange:|gapPosition:|dotPosition:|expandIconPosition:
- id: my_modal
type: Modal
properties:
title: Confirm
visible:
_state: showModal
- id: my_modal
type: Modal
properties:
title: Confirm
open:
_state: showModal
- id: info_tooltip
type: Tooltip
properties:
defaultVisible: true
events:
onVisibleChange:
try:
- id: log
type: SetState
- id: info_tooltip
type: Tooltip
properties:
defaultOpen: true
events:
onOpenChange:
try:
- id: log
type: SetState
- id: progress1
type: Progress
properties:
gapPosition: bottom
- id: carousel1
type: Carousel
properties:
dotPosition: left
- id: progress1
type: Progress
properties:
gapPlacement: bottom
- id: carousel1
type: Carousel
properties:
dotPlacement: left
defaultVisible, gapPosition, dotPosition, expandIconPosition, onVisibleChange are unique property names — safe to rename globally without block-type checkingvisible is NOT unique — it exists on all blocks. Only rename under Modal's properties: sectiongrep -rn 'defaultVisible:\|gapPosition:\|dotPosition:\|expandIconPosition:\|onVisibleChange:' --include='*.yaml' --include='*.yml' .
Should return zero matches. Then manually verify Modal visible → open was applied correctly.