Semantic-UI icon indicating copy to clipboard operation
Semantic-UI copied to clipboard

[Dropdown] - Add search for long dropdowns

Open patie opened this issue 12 years ago • 11 comments

Hi,

what about searching in dropdown in case where is too many items there ? (for example countries)

something like http://ivaynberg.github.io/select2/

patie avatar Jan 06 '14 18:01 patie

Valuable suggestion but not as high priority as some others. Search component will be released shortly to facilitate this gap.

jlukic avatar Jan 06 '14 18:01 jlukic

No problem, i only gather interesting features for next versions (maybe), non-urgent.

patie avatar Jan 06 '14 18:01 patie

What is the current recommended way to handle large selects/dropdowns? (also, what about multiple selects)

I have the same issue as @patie, namely I need my users to select a country (and also a category, amongst many).

There are alternatives such as:

http://ivaynberg.github.io/select2/

and:

http://harvesthq.github.io/chosen/

Unfortunately none of these are available for semantic-ui (there are however bootstrap themes for both of them). Even the native HTML select inputs accept keyboard input, but unfortunately these can't be styled with pure CSS (at least as far as I know).

acornejo avatar Jan 09 '14 04:01 acornejo

@acornejo i used both in past.. now i prefer select2 as my personal preference, imho is better

patie avatar Jan 09 '14 09:01 patie

This feature would be really great and welcomed. Needed also for my projects.

kvetoslavnovak avatar Jan 10 '14 17:01 kvetoslavnovak

http://ivaynberg.github.io/select2/ is really easy to integrate. The following css is enough for my use case (simple select in form using input icons).

I totally do not digg this 'em' stuff, so I hope my lines are no total crap :smiling_imp:

.ui.form .select2-container {
    width: 100%;
    font-size: 0.9rem;
}

.ui.form .select2-chosen {
    padding-top: 0.85em;
    padding-bottom: 0.85em;
    line-height: normal;
}

.ui.form .select2-choice {
    height: auto;
}

.ui.form .select2-arrow {
    padding-top: 0.3em;
}

.select2-drop .select2-result-label {
    font-size: 0.85em;
}

.ui.left.icon.input .select2-choice {
    padding-left: 3em!important;
    padding-right: 1.2em!important;
}

PhilLehmann avatar Mar 15 '14 20:03 PhilLehmann

Hi guys, this feature you can implemented simple:

<div class="ui dropdown selection">
    <input type="hidden" id="bar">
    <i class="empty calendar icon"></i>
    <div class="default text">All</div>
    <i class="dropdown icon"></i>
    <div class="menu">
    <div class="item" data-value=""><input type="search" id="filter_one"></div> <!-- First option -->
    <!-- More options -->
    </div>
</div>
<script>
    var fil = document.getElementById('filter_one');
    fil.addEventListener('click',function(evento){
        evento.preventDefault();
        evento.stopPropagation();
    });
    fil.addEventListener('keyup',function(evento){
        evento.preventDefault();
        evento.stopPropagation();
        var menu = $(this).parent().parent().find(".item");
        for(var i=1; i<menu.length; i++)
        {
            if(menu[i].innerHTML.indexOf(this.value) != -1)
                $(menu[i]).show();
            else
                $(menu[i]).hide();
        }
    });
</script>

codermapuche avatar Jun 10 '14 18:06 codermapuche

+1 for multiselect boxes and typeahead/search features built into a dropdown. Both chosen, and select2 are great little libraries, and not much of a bother to bring into a project. That said, semantic-ui would be that much MORE slick if those features came packaged with it. Something you guys should definitely keep in mind for future releases, imo.

aghreed avatar Jul 29 '14 19:07 aghreed

@dabedur @patie

I've rewritten dropdowns for 1.0 and added many new content types for dropdowns (inputs, labels, images, headers, dividers etc) and a ui search selection dropdown designed for use with large lists.

ui dropdown can now automatically convert <select> lists as well.

See the country select example in the beta docs for an example: http://beta.semantic-ui.com/modules/dropdown.html

The only thing critical feature missing is multiselect/tagging.

jlukic avatar Sep 09 '14 21:09 jlukic

The Multiple Search Selection Dropdown in Semantic UI auto selects an option even if we don't want to. Eg : I select all my choices and then I click anywhere else on the page or press esc, the dropdown menu goes away but ends up selecting an option. Using Semantic UI - 2.2.4

akshayrpatel avatar Sep 28 '16 18:09 akshayrpatel

@akshayrpatel forceSelection: false setting

jlukic avatar Sep 28 '16 20:09 jlukic