Button
A headless Button component for ReactLynx. It provides press state tracking (`active`) and render props for custom styling.Info
You can check the source code to understand how it works, and you're welcome to submit MRs to enhance its capabilities.
Basic Usage
Structure
Component API
Button
The root component of the Button, containing all of its child components.
buttonPropsiOSAndroidHarmony
Button supports original view props to be directly spread in this prop.
classNameiOSAndroidHarmony
className
disablediOSAndroidHarmony
Determines whether the button is disabled.
onClickiOSAndroidHarmony
Triggered when the button is clicked.
styleiOSAndroidHarmony
style
childreniOSAndroidHarmony
children
State-based styling & rendering
This component exposes runtime states through one or both of the following channels. The table lists only the channels available for each state:
- UI variant class — when supported, a class like
ui-<state>is toggled on the corresponding component node for selectors such as.ui-<state> { ... }. - Render-prop field — when supported and
childrenis a function, the state is passed in viachildren({ <state>: boolean, ... })for runtime-driven rendering.
UI variants applied by Button based on its render state.
| Class Name | Render Prop | Type | Description |
|---|---|---|---|
| ui-active | active | boolean | Whether the button is currently being pressed (and not disabled). Applied when `status.active` is true. |
| ui-disabled | disabled | boolean | Whether the button is disabled. Applied when `status.disabled` is true. |