FloatingActionButton combines Root, Icon, Label from the Lynx package. label is required and is used by default as Root's accessibility-label. extended defaults to true.
import IconPlusLine from "@karrotmarket/lynx-monochrome-icon/IconPlusLine";import { FloatingActionButton } from "@/components/ui/floating-action-button";function handleTap() { "background only"; // Handle new post creation action.}export function NewPostButton() { return ( <FloatingActionButton icon={<IconPlusLine />} label="Write new post" bindtap={handleTap} /> );}
When extended={false}, the label is hidden on screen and displayed as a 56×56px icon button. Even then, label remains as the accessibility name of Root. If a different description is needed, specify accessibility-label directly.
Lynx does not have React's <Float> component. Specify position="relative" on the positioning Box, and apply position="absolute", right, bottom to the button wrapper to achieve the same layout.
Events: Use native bindtap instead of onClick. If a handler that changes React state is passed through a wrapper, put "background only" on the first line of the handler.
Accessibility: Use accessibility-label instead of aria-label. The Registry wrapper uses the required label as the default accessibility name, so it preserves the name even in collapsed state.
Rendering: Renders native <view> / <text> and Lynx icon tint instead of HTML <button> / SVG. asChild and DOM button props are not supported.
Floating layout: React's <Float> API is not provided. Specify right and bottom positions with your app's native absolute layout.
The 3.9 in compatibility.lynx.engine is the minimum Engine version that the package requires @lynx-js/types >=3.9.0 and the Scale Feedback path. Check the actual runtime version of the native host separately.