-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu: Add "destructive" state #61079
Comments
My gut feeling is to avoid adding However, there is still a lot of uncertainty around how we want to deal with colors in a systematic way. The components package has an experimental way of doing that, based on CSS variables. But I know @SaxonF has also been working on a color token system. For the time being, especially since DropdownMenuV2 is still private, I wonder if we should stick to directly overriding CSS variables from the consumer code, rather than adding a new API to DropdownMenuItem. |
FWIW, I would also be very cautious with adding props for the same reasons listed by @mirka — especially if what differentiates a "destructive" item from a standard one is just the text color. Until we have more clarity on a few aspects (theming, specs of destructive menu items), I would suggest applying the text color directly to |
Also, if I'm understanding correctly from the conversation in #58390, we may be leaning towards having "destructive" actions requiring a confirmation dialog, meaning that the menu item would not need to have any distinctive "destructive" styles (since those styles should be applied to the button in the confirm dialog) |
What problem does this address?
In WordPress core and Gutenberg, a button typically appears red if its action is destructive.
Delete Template:
Move Post to Trash:
Move Post to Trash (Classic Editor):
On the other hand, in the UI already implemented with
DropdownMenuItemV2
components, these action buttons are not red.Delete template:
Move Post to Trash:
What is your proposed solution?
As far as I know, no option exists to make the
DropdownMenuItemV2
color red. I imagine that something like theisDestructive
prop of the button component could be used for these use cases.Below is a list of the states I would expect.
Default:
Hovered:
Focused:
The text was updated successfully, but these errors were encountered: