day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
797 stars 147 forks source link

multi-select with option map #131

Closed Conaws closed 3 years ago

Conaws commented 7 years ago

Submitting a component for chosen style multi-complete with typeahead. It doesn't yet totally match the look and feel of all the other re-com components, and in this implementation it accepts all the options as a map -- rather than the re-com style of validating arguments separately.

See example here https://github.com/Day8/re-com/issues/115

In my use case I wanted users to be able to submit new options, so that is the default behavior, I imagine that that might be an option that could be disabled.

I'll be offline for the next few weeks, but figured if someone else had interest they could convert it from using an options map to following the re-com format. Otherwise, very open to suggestions about what the options the component should accept, and can complete the conversion later.

Gregg8 commented 7 years ago

In terms of API, I would suggest the following (starting with what is already there):

:selections       rename to :model
:suggestions
:save!            rename to :on-change
:on-delete!       rename to :on-delete
:placeholder      
:highlight-class  
:item-class       
:list-class

Additional:

:rigid?           true means only allow values from :suggestions
:width            default is to take up width of container as is currently the case
:height           default should be default height of input-text, ideally tags should scale nicely within this height
:disabled?        common in re-com components
:class            apply to the outer h-box
:style            apply to the outer h-box
:attr             apply to the outer h-box
Gregg8 commented 7 years ago

Observation: Looks like #150 is overlapping with the functionality of this PR.

superstructor commented 3 years ago

224 will provide equivalent or better functionality in the next release. Please raise a new PR to add to that component if you find anything missing/lacking.

Thanks anyway for submitting this @Conaws 👍