casesandberg / react-color

:art: Color Pickers from Sketch, Photoshop, Chrome, Github, Twitter & more
http://casesandberg.github.io/react-color/
MIT License
12.05k stars 922 forks source link

Allow us to set width for the color picker #949

Open Nefcanto opened 1 week ago

Nefcanto commented 1 week ago

Look at this form:

image

I know I can create a parent component and only show the selected color and when clicked open the color picker. I also know that I can create a simple dialog where people would choose the color.

But I prefer to show the color picker inline due to some constraints related to this specific app.

If I could add className="w-full" then everything would be OK.

Allow us to specify the width for this component to be able to align it nicely when we use it inline.

vakharia-aarya commented 9 hours ago

I'm pretty sure the Sketch component has a width prop, you could set it dynamically depending on your page dimensions to get the desired behavior. Check the api definition in the docs: https://casesandberg.github.io/react-color/#api-individual

Nefcanto commented 14 minutes ago

@vakharia-aarya, thank you for that tip. Yet the width property won't help in this case. Because it's a fluid design. I don't know the width of the container form. I need to just tell it take the entire space available.