This package treats ref as an explicit component capability, not an accidental side effect of inheriting DOM props.
- Use
React.ComponentPropsWithoutRef<'tag'>for DOM-derived prop interfaces by default. - Only expose
refwhen the component intentionally supports DOM access throughReact.forwardRef. - Do not rely on
React.ComponentProps<'tag'>to leakrefinto props interfaces. - If a component is primarily compositional or layout-only, do not expose
refunless there is a concrete DOM integration need.
- Interactive controls and focus targets such as
Button,Input,NativeSelect,Link,Switch,Checkbox,Radio. - Components frequently used for measurement, scrolling, positioning, or animation integration such as
Tree,Slider,Grid,Space,Flex,Layout,Anchor,Waterfall,Transfer,Steps, and typography primitives.
- Grouping or compositional wrappers such as
Button.Group,Checkbox.Group,Radio.Group,Input.Group,Input.Addon,Form.Item,Descriptions,Descriptions.Item.
- If consumers need the outer wrapper and an inner native control, expose both intentionally, for example
CheckboxpluscheckboxRef, orRadioplusradioRef. - If a component renders different DOM elements by state, make the forwarded ref type reflect that reality instead of pretending it always points to one tag.
- When adding a new forwarded ref, add a focused test that proves the ref resolves to the expected DOM node.