Skip to content
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

DropdownMenuItemV2: Add "destructive" state #61079

Open
t-hamano opened this issue Apr 25, 2024 · 1 comment
Open

DropdownMenuItemV2: Add "destructive" state #61079

t-hamano opened this issue Apr 25, 2024 · 1 comment
Labels
Needs Design Feedback Needs general design feedback. [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Comments

@t-hamano
Copy link
Contributor

What problem does this address?

In WordPress core and Gutenberg, a button typically appears red if its action is destructive.

Delete Template:
image

Move Post to Trash:
image

Move Post to Trash (Classic Editor):
image

On the other hand, in the UI already implemented with DropdownMenuItemV2 components, these action buttons are not red.

Delete template:
image

Move Post to Trash:

image

What is your proposed solution?

As far as I know, no option exists to make the DropdownMenuItemV2 color red. I imagine that something like the isDestructive prop of the button component could be used for these use cases.

Below is a list of the states I would expect.

Default:

image

Hovered:

image

Focused:

image

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Apr 25, 2024
@t-hamano t-hamano changed the title DropdownMenuItemV2 DropdownMenuItemV2: Add "destructive" state Apr 25, 2024
@mirka mirka added the Needs Design Feedback Needs general design feedback. label Apr 25, 2024
@mirka
Copy link
Member

mirka commented Apr 25, 2024

My gut feeling is to avoid adding isDestructive as a prop, since that can lead to prop bloat like we can see in the current Button API. This is just a color variant, so ideally it would be done through a color-related API.

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.

cc @DaniGuardiola

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback. [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants