onesine / react-tailwindcss-select

Tailwind Select Component for React.js
https://demo-react-tailwindcss-select.vercel.app/
MIT License
183 stars 38 forks source link

formatTagItem #26

Open Djboy08 opened 1 year ago

Djboy08 commented 1 year ago

Currently we have formatting functions for options and groups. However, atleast with my observations so far there is no function for the data inside the button itself. For my use case I have custom tags I want to be able to also represent in the button itself but unable to do so.

image

cha2hyun commented 1 year ago

Hello @Djboy08 👋

Can you give me some more information or code?

Djboy08 commented 1 year ago

Yeah so in the image I provided I was talking about the location where it says Type 2. I wish we could add our own html in there as I would prefer being able to have something like the bottom formatted options to also be put in the top when its selected.

However, from what I could see there is no way to do this and you can only alter the css of the menu button but not change it depending on the data associated with it.

So what I ideally would like is if I clicked on Test 2 or Test 3 in the provided image, that exact option could also show up in the image button.

Something like a formatSelectedOption or something would be nice :)

Djboy08 commented 1 year ago

image

You can see in this example my options are my own custom css styling but is there anyway to make the selected values also custom css?

Djboy08 commented 1 year ago

I noticed there was a tagItem prop, sadly this doesnt solve my use case as this is the only time I can't use tailwind css to acomplish my needs by applying css to said tags. I need to be able to change the background use hex.

so really I guess what I want is a formatTagItem callback, this would be incredibly useful.