bluzky / nice-select2

A lightweight vanilla javascript library that replaces native select elements with customizable dropdowns
https://bluzky.github.io/nice-select2/
MIT License
361 stars 60 forks source link

Added option to show selected items #39

Closed zaru closed 1 year ago

zaru commented 2 years ago

Proposal.

Add option to display items selected by multiple attributes. This option allows for flexibility in the way it looks.

For example, in CSS, it can be displayed comma-separated.

.nice-select.has-multiple {
  .multiple-options {
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }
  .current {
    &:before {
      content: ' , ';
    }
    &:first-of-type {
      &:before {
        content: '';
      }
    }
  }
}