element-hq / compound

Element's design system
https://compound.element.io
Apache License 2.0
12 stars 3 forks source link

Reorganise and cleanup the form elements #249

Open sandhose opened 1 year ago

sandhose commented 1 year ago

While working on the readonly state on forms and the MFA component, I noticed that the form-related components are weirdly organised and don't always have the best implementation. Sorry for the "brain-dump" style list, I can open individual issues if needed.

dav-is commented 1 year ago

I think we should use radix for all of them or none of them (and use </Form.Control> for example?)

I'm not sure if this has been discussed elsewhere, but I think we should use Radix for all of them. Ideally, we should use Radix for as much as possible.

sandhose commented 1 year ago

I think we should use radix for all of them or none of them (and use </Form.Control> for example?)

I'm not sure if this has been discussed elsewhere, but I think we should use Radix for all of them. Ideally, we should use Radix for as much as possible.

With the right ref forwarding, it's possible to provide both a bare input and a radix control. Check out what I did in the PR here: https://github.com/vector-im/compound-web/blob/7fc69ca21e3472dc938c7bc93be919c27209614e/src/components/Form/Controls/Text/Text.tsx#L34

It also makes it easier to do stories if we have an input component which is not controlled by radix

dav-is commented 1 year ago

It also makes it easier to do stories if we have an input component which is not controlled by radix

How so? What are the benefits to using an input without Radix? I thought we get a lot of accessibility built in using Radix