packages/lynx-ui-button/SKILL.md
# lynx-ui-button SKILL `Button` is a member of the `lynx-ui` atomic library. It provides an unstyled, fully functional button "skeleton", focusing on handling interaction behaviors and accessibility. ## 1. Core Capabilities Unlike `lynx-ui-button`, which is a high-level component providing complete styling and multiple variants, the goal of `Button` is to: - **Provide core button behavior**: Encapsulates `onClick` events, `disabled` state, and the active state during press (`active` state).
npx skillsauth add lynx-family/lynx-ui packages/lynx-ui-buttonInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Button is a member of the lynx-ui atomic library. It provides an unstyled, fully functional button "skeleton", focusing on handling interaction behaviors and accessibility.
Unlike lynx-ui-button, which is a high-level component providing complete styling and multiple variants, the goal of Button is to:
onClick events, disabled state, and the active state during press (active state).active) through the children Render Prop pattern, facilitating the implementation of complex press effects.When you need an interactive element that is visually completely custom but behaviorally conforms to standard button specifications, you should use Button.
The core feature of Button is its Render Prop. You need to provide a function as children to receive the active state.
import { Button } from '@lynx-js/lynx-ui'
function App() {
const handleClick = () => {
console.log('Button clicked!')
}
return (
<Button onClick={handleClick}>
{({ active }) => (
<view
style={{
padding: '10px 20px',
backgroundColor: active ? '#cccccc' : '#eeeeee',
border: '1px solid #999999',
borderRadius: 4,
}}
>
<text>My Custom Button</text>
</view>
)}
</Button>
)
}
Scenario: I want to use
Buttonto create a custom button. Appearance Requirement: This button's background color is[normal_color]in its normal state, and when the user presses it (activestate), the background color changes to[active_color]. Behavior Requirement: In the [enabled/disabled] state, the button needs to [perform some action, e.g., "print a log"] when clicked.
Example Prompt:
I want to use
Buttonto create an icon button. It should be a circular button with no background color. When the user presses it, the entire button area's background should become semi-transparent gray (rgba(0,0,0,0.1)). When the button is clicked, it should call thehandleIconClickfunction. Please provide the implementation code.
Q: Why doesn’t the button react to the active state?
A: Button uses a Render Prop. Provide a function as children so you can receive { active } and style accordingly.
// Correct usage
<Button onClick={handleClick}>
{({ active }) => (
<view style={{ backgroundColor: active ? '#ccc' : '#eee' }}>
<text>My Button</text>
</view>
)}
</Button>
Q: How do I handle disabled styles?
A: disabled prevents onClick from firing but doesn’t auto-style the button. Pass disabled into your style logic and apply the visual state manually.
<Button disabled={true} onClick={handleClick}>
{({ active }) => (
<view style={{ opacity: 0.5 }}>
<text>Disabled Button</text>
</view>
)}
</Button>
When your design system requires a button with a completely new look and feel that cannot be met by overriding the styles of lynx-ui-button.
// GradientButton.tsx
const GradientButton = ({ children, onClick }) => (
<Button onClick={onClick}>
{({ active }) => (
<view
style={{
background: active
? 'linear-gradient(to right, #ff7e5f, #feb47b)'
: 'linear-gradient(to right, #6a11cb, #2575fc)',
color: 'white',
padding: '12px 24px',
borderRadius: 50,
boxShadow: active ? 'none' : '0 4px 15px rgba(0,0,0,0.2)',
transition: 'all 0.2s',
}}
>
{children}
</view>
)}
</Button>
)
Practice: With the active state, you can easily implement complex press effects, such as changing gradients, shadows, scaling, etc.
Button is a single component and does not contain sub components.
development
# lynx-ui-sortable SKILL `Sortable` is a headless drag-to-reorder list primitive for ReactLynx. It performs reordering on the main thread for smooth, gesture-driven animations and exposes a composable `SortableRoot` / `SortableItem` / `SortableItemArea` API. For massive datasets, prefer `List` or `FeedList`; `Sortable` targets small to medium reorder-able lists. ## 1. Core Capabilities - **Headless Composition**: Three building blocks — `SortableRoot`, `SortableItem`, and (optional) `Sortable
development
# lynx-ui-sheet SKILL ## What It Is `lynx-ui-sheet` is a headless Sheet primitive for ReactLynx. It supports bottom-sheet semantics and side-drawer semantics through the same composition model, state model, drag handling, backdrop, and snap-point APIs. Use it when a UI needs a dismissible panel that slides from an edge of the viewport and may be controlled by refs, external state, snap points, or drag gestures. ## Building Blocks - **`SheetRoot`**: Owns visibility state, side, snap points,
development
# Lynx UI Popover SKILL `lynx-ui-popover` is a headless primitive for building accessible, positioned floating elements. It handles the complex logic of positioning, stacking context, and enter/exit animations via `usePresence`. ## 1. Core Capabilities - **Headless & Composable**: Provides raw functional components (`Root`, `Trigger`, `Positioner`, `Content`) that you compose to build custom UIs. - **Auto Positioning**: The `PopoverPositioner` automatically calculates coordinates to anchor th
development
# lynx-ui-dialog SKILL `Dialog` is a dialog component, used to display important information or require user interaction, interrupting the current workflow. `lynx-ui-dialog` is a composite component built on `primitives`, offering high flexibility and customizability. ## 1. Core Capabilities - **Composite Component Structure**: Composed of `DialogRoot`, `DialogView`, `DialogBackdrop`, `DialogContent`, `DialogTrigger`, and `DialogClose`, allowing for free assembly of the dialog's structure. -