N00nDay / stwui

Opinionated yet customizable Svelte-TailwindCSS component library
stwui.vercel.app
MIT License
447 stars 21 forks source link

Missing binding examples for all form components #189

Open jerefrer opened 10 months ago

jerefrer commented 10 months ago

Link to the Page

https://stwui.vercel.app/toggle

Describe the Issue (screenshots encouraged!)

I'll take the Toggle component for instance.

We have many examples demonstrating the use of all kinds of options, but nowhere on the page is actually explained how to wire this component to a Svelte variable.

To understand that I need to scroll all the way down to the Toggle Props table and understand that I should bind:on={myVar}.

Same with Checkbox, I have to understand that I need to bind:checked={myVar} by looking way down the doc page. And then when looking in the console I see <Checkbox> was created without expected prop 'value', so I have to end up with something like the following to get rid of the warning:

<Checkbox
    name="my-variable"
    value={myVar}
    bind:checked={myVar}
>
    <Checkbox.Label slot="label">My variable</CheckboxGroup.Checkbox.Label>
</Checkbox>

And I'm not even sure that's absolutely necessary, since it works just with the bind:checked={myVar}. Then there was this bug coming from omitting to set the name attribute.

Wouldn't it be much simpler that all examples for all form components include something like bind:on={myVar}? In that way the example could just be copied and pasted in one's code without spending more time trying to understand how STWUI was built.

It was even more frustrating for me when I tried to use Select, as I tried to describe in this other issue.

Thank you for reading all this, and for building this library that is otherwise quite enjoyable to use ;)

N00nDay commented 10 months ago

I don't disagree with you. This just comes back to available time. If I get a moment I will work on this but functionality always wins for the moments I do have available.

jerefrer commented 10 months ago

Thank you for at least having found the time to consider all my complaints :)

Are the docs also on Github? Could I maybe try to find time to make a pull request for that one?

ogrotten commented 9 months ago

but functionality always wins for the moments I do have available.

And yet documentation or clearer UX would have prevented 2 posts.

N00nDay commented 9 months ago

Thank you for at least having found the time to consider all my complaints :)

Are the docs also on Github? Could I maybe try to find time to make a pull request for that one?

The docs are included in this repo so they can be altered within the repo. My apologies for the delayed response. End of year with work and holidays have been keeping me tied up at the moment. Please feel free to contribute by updating the docs. It would be greatly appreciated!