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

Are dropdowns with checkboxes possible? #2417

Closed
panpingo opened this issue Jan 10, 2018 · 14 comments
Closed

Are dropdowns with checkboxes possible? #2417

panpingo opened this issue Jan 10, 2018 · 14 comments

Comments

@panpingo
Copy link

Something like this (first result from google):

https://codepen.io/elmahdim/pen/hlmri

That is, I'm looking for kinda the opposite of https://react.semantic-ui.com/modules/dropdown#dropdown-example-multiple-selection

So the items would be checked but the display text shown when collapsed would never change.

Is this possible with the existing library?

@levithomason
Copy link
Member

Active items are automatically removed from the Dropdown menu. So you cannot show a "checked" state for an item in the menu.

You could create a similar component out of an Input as a trigger for a Popup containing a Menu or List of Checkboxes.

@hugomn
Copy link

hugomn commented Jun 5, 2018

@levithomason Isn't it an option to have this in Semantic-UI-React? We could have an option that we could keep the items when selected and display the checkbox. I can make a PR for this feature. Let me know if there is any other place to track new features like this.

@As3toJs
Copy link

As3toJs commented Jul 16, 2018

Hi, @hugomn @panpingo did you guys manage to get react-semantic dropdowns with checkboxes ? any solution for that ?

@hugomn
Copy link

hugomn commented Jul 16, 2018

HI @piyushkathayat! I have a local version of SUIR dropdown working with checkbox and multi-levels. I was planning to push it to our SUIR fork, but I'm not sure if that will be merged, because it's not on the official SUI specs and they are now planning SUIR v2.0 that will be totally independent of CSS frameworks. I'm waiting for @levithomason advice here to understand the best way to proceed.

ezgif com-video-to-gif

@As3toJs
Copy link

As3toJs commented Jul 16, 2018

@hugomn looks cool. nice work. Thanks. lets wait for @levithomason comments.

@xumix
Copy link

xumix commented Feb 11, 2019

any news on this?

@TimJulius
Copy link

Any news on this?

@hugomn
Copy link

hugomn commented May 12, 2019

It seems like dropdowns with multiple selection won't be part of Semantic-ui specs. 🤷🏻‍♂️

@FadyQJ
Copy link

FadyQJ commented May 30, 2019

Well that's too bad :(

@clearly
Copy link

clearly commented Jun 2, 2019

It seems like dropdowns with multiple selection won't be part of Semantic-ui specs. 🤷🏻‍♂️

How about packaging this as a separate package?

@pedrosimao
Copy link

@hugomn could you share with us this menu version with multi-levels and checkboxes? It is just what I need.

@ldalves
Copy link

ldalves commented Oct 29, 2019

@hugomn would you mind in sharing your code of this menu version with multi-levels and checkboxes?

@eugenetumachov
Copy link

Even though the issue is closed, it makes sense to provide everyone with a working example. This works for me:

<Dropdown item simple text="Select...">
  <Dropdown.Menu>
    <Dropdown.Item>
      <Checkbox label="Choice one" />
    </Dropdown.Item>
    <Dropdown.Item>
      <Checkbox label="Choice two" />
    </Dropdown.Item>
  </Dropdown.Menu>
</Dropdown>

However, some additional CSS is required to fix labels width and to make the list scrollable.
Here is also a CodeSandbox with some interaction: https://codesandbox.io/s/semantic-ui-dropdown-checkboxes-kxvq0

@sergivna
Copy link

scope.getLabel = function (item) { return '<input type="checkbox">' + item; };

<sm-dropdown items="property.values" label="getLabel(item.value)" value="item.value" />

I managed to do it in this way, in my angularJs project.
Maybe, it will help..

@Semantic-Org Semantic-Org locked as resolved and limited conversation to collaborators Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests