smooth-ui icon indicating copy to clipboard operation
smooth-ui copied to clipboard

Add another ref prop for `Checkbox` and `Radio` component

Open ryanwang520 opened this issue 5 years ago • 0 comments

🚀 Feature Proposal

Checkbox and Radio components provide some way to access the underlying input element.

Motivation

Sometimes it's handy to access the input element directly(Such as integrate with react-hook-form), while the Checkbox and Radio components both only accept the ref prop which let us access the wrapping div element.

Example

<label>
    <Checkbox name="checkbox" ref={ref}  /> check me
</label>
//  ref does not refer to the actual `input` element, maybe add `innerRef` prop? 
<Checkbox name="checkbox" ref={ref} innerRef={checkboxInputRef}  />

ryanwang520 avatar Nov 19 '19 04:11 ryanwang520