react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

useSwitch does not expose validation API

Open vbudovski opened this issue 1 year ago โ€ข 5 comments

Provide a general summary of the feature here

Unlike most other hooks, the useSwitch hook does not provide isInvalid and validationErrors properties.

๐Ÿค” Expected Behavior?

useSwitch exposes the standard validation API.

๐Ÿ˜ฏ Current Behavior

useSwitch does not expose the standard validation API.

๐Ÿ’ Possible Solution

useSwitch exposes the standard validation API.

๐Ÿ”ฆ Context

It makes usage in forms difficult as it does not behave like other inputs.

๐Ÿ’ป Examples

const { inputProps, isInvalid, validationErrors } = useSwitch(props, state, ref as RefObject<HTMLInputElement>);

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

vbudovski avatar Dec 09 '23 02:12 vbudovski