packages/lynx-ui-lazy-component/SKILL.md
Provide the information about the `<LazyComponent>`. Show the common use cases, basic usage, and critical development Advises.
npx skillsauth add lynx-family/lynx-ui LazyComponentInstall 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.
<LazyComponent> is a component that lazy loads the content when it is visible in the viewport.
<ScrollView>, <List>, <FeedList>, etc. Usually used for speed up the initial loading time.<LazyComponent> in the slot of <ScrollView> so that the content of the items are only loaded when they are visible in the viewport.<LazyComponent> is used to display the content of the page only when it is visible in the viewport.
import { LazyComponent } from '@lynx-js/lynx-ui'
function App() {
return (
<view>
<LazyComponent
scene={'scene'}
pid={'pid'}
estimatedStyle={{ width: '1px', height: '1px' }}
>
<RealItem />
</LazyComponent>
</view>
)
}
You can build a virtualized list by embedding <LazyComponent> in the slot of <ScrollView>.
import { LazyComponent } from '@lynx-js/lynx-ui'
import { ScrollView } from '@lynx-js/lynx-ui'
function App() {
return (
<ScrollView
scrollOrientation='vertical'
lazyOptions={{ enableLazy: false }}
style={{ width: '100%', height: '400px' }}
>
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
[...Array(20)]
.map((_, index) => index)
.map((_item, index) => (
<LazyComponent
key={index}
scene={'scene'}
pid={`pid_${index}`}
estimatedStyle={{ width: '100%', height: '100px' }} // make sure the estimated size is equal to the real size
unmountOnExit
>
<view
style={{
width: '100%',
height: `${300 + index * 10}px`,
padding: '5px',
border: '50px red',
}}
>
<text>item</text>;
</view>
</LazyComponent>
))
}
</ScrollView>
)
}
You can adjust the exposure margin of <LazyComponent> by setting the bottom, top, left, and right props. So that the content of the item is loaded earlier than it is visible in the viewport.
import { LazyComponent } from '@lynx-js/lynx-ui'
function App() {
return (
<view>
<LazyComponent
scene={'scene'}
pid={'pid'}
bottom='200px'
top='200px'
left='200px'
right='200px'
estimatedStyle={{ width: '1px', height: '1px' }}
>
<RealItem />
</LazyComponent>
</view>
)
}
estimatedStyle prop is required. It is an object that specifies the estimated size of the content of the item. The estimated size could be equal to or smaller than the real size of the content.scene and pid props are required. They are used to identify the item. Their combination must be unique.bottom, top, left, and right props is that to expand the exposure margin of the item. The default value is 0px.unmountOnExit to specify whether the content of the item should be unmounted when it is out of the viewport.unloadable is deprecated and kept only for backward compatibility. Prefer unmountOnExit.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. -