nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
3.4k stars 374 forks source link

RadioGroup lacks `optionAttribute` and `valueAttribute` #1725

Closed davestewart closed 3 weeks ago

davestewart commented 3 weeks ago

Description

The RadioGroup component lacks the optionAttribute and valueAttribute which Select and SelectMenu have, so you're forced to map existing object properties to label and value.

Also, in the context of a radio button, perhaps optionAttribute might be best-called labelAttribute.

Additional context

I'd be happy to PR this; looks like quick win.

I note that the docs would also need updating.

benjamincanac commented 3 weeks ago

The RadioGroup has an optionAttribute and valueAttribute props 🤔

https://github.com/nuxt/ui/blob/dev/src/runtime/components/forms/RadioGroup.vue#L66-L73

davestewart commented 3 weeks ago

Maybe time for me to book an eye test 😂

Could also be that the Radio props are shown by default on the RadioGroup page and I missed the second tab.

davestewart commented 2 weeks ago

Actually, what it really is, is that the SelectMenu component has a full section on usage objects, but Select and RadioGroup do not:

https://ui.nuxt.com/components/select-menu#objects

I think they should at least mention it's supported, and link to the SelectMenu section for more info.

Want me to PR @benjamincanac ?

benjamincanac commented 2 weeks ago

The Select mentions objects at the beginning: https://ui.nuxt.com/components/select#usage and RadioGroup always takes objects but it does miss the section about value-attribute indeed.

davestewart commented 2 weeks ago

The sidebar sections are inconsistent too, which is a shame as the API is!

I'll see if I can find some time this week to tweak.