react-spectrum
react-spectrum copied to clipboard
field components should consistently support isReadOnly and isRequired render-props+data-attributes
Provide a general summary of the feature here
this is continuing https://github.com/adobe/react-spectrum/issues/5930#issuecomment-1988997419
field components (i.e. those which can be used in a form) should consistently support disabled/invalid/readonly/required props, render-props, and data attributes.
i have tried to list the current support here (although not every case may make sense to support). also, i have not yet created a separate table for data-attributes, but it seems that these match render-props support:
props
| RAC | isDisabled | isInvalid | isReadOnly | isRequired |
|---|---|---|---|---|
| CheckboxGroup | ✅ | ✅ | ✅ | ✅ |
| ComboBox | ✅ | ✅ | ✅ | ✅ |
| Date/TimeField | ✅ | ✅ | ✅ | ✅ |
| NumberField | ✅ | ✅ | ✅ | ✅ |
| RadioGroup | ✅ | ✅ | ✅ | ✅ |
| SearchField | ✅ | ✅ | ✅ | ✅ |
| Select | ✅ | ✅ | ❌ | ✅ |
| Slider | ✅ | ❌ | ❌ | ❌ |
| Switch | ✅ | ❌ | ✅ | ❌ |
| TextField | ✅ | ✅ | ✅ | ✅ |
render props
| RAC | isDisabled | isInvalid | isReadOnly | isRequired |
|---|---|---|---|---|
| CheckboxGroup | ✅ | ✅ | ✅ | ✅ |
| ComboBox | ✅ | ✅ | ❌ | ✅ |
| Date/TimeField | ✅ | ✅ | ❌ | ❌ |
| NumberField | ✅ | ✅ | ❌ | ❌ |
| RadioGroup | ✅ | ✅ | ✅ | ✅ |
| SearchField | ✅ | ✅ | ❌ | ❌ |
| Select | ✅ | ✅ | ❌ | ✅ |
| Slider | ✅ | ❌ | ❌ | ❌ |
| Switch | ✅ | ❌ | ✅ | ❌ |
| TextField | ✅ | ✅ | ✅ | ✅ |
🤔 Expected Behavior?
see above
😯 Current Behavior
see above
💁 Possible Solution
No response
🔦 Context
see above
💻 Examples
No response
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Thanks for the issue and the details Related https://github.com/adobe/react-spectrum/issues/6192