💬 Proposal: Support "danger" color styling in EuiContextMenuItem for destructive actions #8735
Unanswered
weronikaolejniczak
asked this question in
Design Decision
Replies: 3 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm wondering if we actually highlight those kind of actions only on hover? (e.g. like Notion does: one / two). |
Beta Was this translation helpful? Give feedback.
1 reply
-
@ek-so you mean change the style to danger on hover? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
While working on the Search Query Rules UI, the team wanted to highlight destructive actions (e.g., "Delete") using the danger color. During implementation, they observed that passing
color: 'danger'
only applies styling if the action is rendered as anEuiButtonIcon
withisPrimary: true
. This color does not carry over toEuiContextMenuPanel > EuiContextMenuItem
.Current behavior
This appears to be the expected behavior in EUI currently. For example, in the Row actions documentation (toggle the "Multiple actions" switch), the hover state shows a styled
trash
icon but when those actions are moved into a context menu, the "Delete" item is plainly styled.Workaround
However, coloring can be achieved using a custom render with e.g.
EuiLink
:as shown by the example (toggle the "Custom actions" switch). This approach works as a workaround if custom rendering is acceptable and approved by designers.
The workaround works but comes with limitations:
color: 'danger'
is much simpler.Design consideration
Destructive actions highlighted in red are a common UI pattern. In fact, our Figma library currently supports this design approach. Adding official support for
color: "danger"
inEuiContextMenuItem
would make this more consistent and reusable across use cases.Proposal
Let’s define next steps and design/technical requirements for supporting
color: "danger"
inEuiContextMenuItem
.We'd have to update EUI documentation to reflect guidance around destructive actions in context menus: EuiBasicTable and EuiContextMenu.
Would love to hear from maintainers and designers (@ryank, @kate.s, @elastic/eui-team and others) before proceeding with a formal implementation or workaround. Should this be part of EUI’s supported patterns?
Beta Was this translation helpful? Give feedback.
All reactions