Migration from DeprecatedMenu/Menu in preview-react to Menu in main #2063
josh-bagwell
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This will be a migration guide to help the migration from the
DeprecatedMenu
/Menu
component that is a part of thepreview-react
to theMenu
compound component that is inmain
. Please see theMenu
documentationhere.
If you would like to see the differences between
DeprecatedMenu
and theMenu
compound component,see this codesandbox example.
See below for how these components will migrate:
<DeprecatedMenu/> -> <Menu/>
(This will be the parent container that wraps those)
<DeprecatedMenuItem/> -> <Menu.Item/>
<Popup/>
Not needed to wrap
<Popup.Popper/> -> <Menu.Popper/>
The "Popper" of a menu. The popper will appear around the
Menu.Target
. It renders adiv
element that is portalled to thedocument.body
which is controlled by thePopupStack
. ThePopupStack
is not part of React. This means no extra props given to this component will be forwarded to thediv
element, but theref
will be forwarded.<Popup.Target/> -> <Menu.Target/>
hasDivider -> <Menu.Divider/>
This will need to be moved from a prop to a sub-component. This is a divider for the
<Menu.Card/>
The menu card is a non-semantic element used to give the dropdown menu its distinct visual cue that the dropdown menu is floating above other content. A menu card usually contains a menu list, but can also contain other elements like a header or footer.
<Menu.List/>
The menu list follows the Collections API. A list can either contain static items or a render prop and
items
to the model.Below are some basic examples of
DeprecatedMenu
and theMenu
component frommain
.DeprecatedMenu
andDeprecatedMenuItem
:Menu
:Beta Was this translation helpful? Give feedback.
All reactions