Usage
injectChild true): preserve the child element type while merging interactive props (for example a styled container that must stay a non-button element for CSS reasons).| Aspect | Purpose | Emphasis |
|---|---|---|
Default injectChild false | Renders a button-like wrapper | Prefer when you can accept button semantics |
injectChild true | Merges into child via slot | Child must forward props; test focus and role |
InteractableType | Visual feedback presets | Not a substitute for semantic state; pair with design |
active | Shows selection within a set | Don’t use alone for “pressed” without aria-pressed when it behaves as a toggle |
disabled | Blocks interaction | Keep visible only when the user needs to know the action exists |
onClick, keyboard handlers (Enter / Space), tabIndex, and disabled behavior. Nested interactive elements require explicit event handling so inner controls don’t fire the outer handler unintentionally.
aria-label (or labelled-by) that states the action, not the visual style.aria-pressed or the appropriate role when state changes meaning, not only color.aria-expanded and move focus sensibly.Enter and Space activate; don’t swallow keys needed by nested inputs.active and disabled props.injectChild only when you’ve verified the child can receive merged props and remains accessible.role="button" (or use real button) and support keyboard activation.outline: none without replacement.