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

Create a custom Button/Context Menu pattern that behaves like a Form Select #274

Closed
cchaos opened this issue Jan 9, 2018 · 3 comments
Closed

Comments

@cchaos
Copy link
Contributor

cchaos commented Jan 9, 2018

We need a way to use Context Menu's in forms to allow for more complex selections. However, the triggering element for the context menu should simulate the behavior of a select element not a button.

screen shot 2018-01-09 at 13 10 33 pm

Question

Do we still use a <select> element that can trigger a context menu, or do we style a <button> to look like the <select> element?

@cjcenizal
Copy link
Contributor

I think this EuiSuperSelect component would need to consist of three things:

  1. The button, styled to look like the select
  2. An invisible input to contain the selected value. This way the component can be part of a form which, when submitted, will pick up the value of the invisible input.
  3. The popover component, which the consumer should be able to pass to the component. This can be something like what's in your mockup, a list of radio buttons, a bunch of regular buttons, or whatever. As long as this component surfaces an onChange prop, it will work.

When the user selects an item from the popover component, the onChange is called with the selection. The consumer is responsible for storing this value and passing it to the EuiSuperSelect via the value prop. The EuiSuperSelect then sets it on the invisible input and updates the button text.

@snide snide mentioned this issue Apr 30, 2018
44 tasks
@peteharverson
Copy link

This sort of control, allowing non-textual elements in the select options, would also be useful in the ML UI, to replace the current Angular UI Bootstrap dropdown control, which includes icons in the option values:

image

I can achieve something close to what I need with the EuiComboBox in single selection mode, but ideally I'd like to have the selection rendered with the same health icons used in the options, rather than the pill type indicator:

severity_euicombobox

@cchaos cchaos mentioned this issue Jun 12, 2018
3 tasks
@snide
Copy link
Contributor

snide commented Aug 16, 2018

Closable because of #921

@snide snide closed this as completed Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants