Lynx UI logo
Lynx UI

<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

Button

The root component of the Button, containing all of its child components.

buttonProps
iOS
Android
Harmony
TypeViewProps
Button supports original view props to be directly spread in this prop.
className
iOS
Android
Harmony
Typestring
className
disabled
iOS
Android
Harmony
Typeboolean·Defaultfalse
Determines whether the button is disabled.
onClick
iOS
Android
Harmony
Type() => void
Triggered when the button is clicked.
style
iOS
Android
Harmony
TypeCSSProperties
style
children
iOS
Android
Harmony
Type| ReactNode | ((state: {active: boolean, disabled: boolean}) => ReactNode)
children

State-based styling & rendering

This component exposes each of its internal states through two interchangeable channels, and the table below maps them one-to-one:

  • CSS className — a class like ui-<state> is toggled on the root node, so you can style it with selectors such as .ui-<state> { ... }.
  • Render-prop field — when children is a function, the same state is passed in via children({ <state>: boolean, ... }) for runtime-driven rendering.
ui-active
Render Propactive·Typeboolean
Whether the button is currently being pressed (and not disabled). Applied when `status.active` is true.
ui-disabled
Render Propdisabled·Typeboolean
Whether the button is disabled. Applied when `status.disabled` is true.
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.