ReferenceUtils
useButton
Hook for creating accessible button components with keyboard and pointer interaction
Import
useButton provides button behavior including keyboard activation and accessibility checks. It returns a getButtonProps function for spreading onto a <button> element and a buttonRef for validation.
getButtonProps merges internal button props (click/keyboard handlers, disabled state) with any external props you pass in. Use renderElement to render the button with state-driven props and render prop support. In development mode, buttonRef warns if the rendered element is not a <button>.