# Contextual Floating Button URL: /lynx/components/contextual-floating-button Source: https://github.com/daangn/seed-design/blob/dev/docs/content/lynx/components/contextual-floating-button.mdx A button that floats on the screen and appears only in specific situations to provide auxiliary actions. Lynx Engine 최소 버전: 3.9 사용 가능 버전: @seed-design/lynx-react@0.8.0, @seed-design/lynx-css@0.12.0 ## Installation - npm: npm install @seed-design/lynx-react @seed-design/lynx-css - pnpm: pnpm add @seed-design/lynx-react @seed-design/lynx-css - yarn: yarn add @seed-design/lynx-react @seed-design/lynx-css - bun: bun add @seed-design/lynx-react @seed-design/lynx-css Lynx `ContextualFloatingButton` is provided directly from the `@seed-design/lynx-react` package without a separate `ui:contextual-floating-button` snippet. ## Usage ## Preview ```tsx import IconBellFill from "@karrotmarket/lynx-monochrome-icon/IconBellFill"; import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react"; export default function Example() { return ( } /> 알림 설정 ); } ``` Icon colors are not applied in the web preview. Check the actual icon colors in Lynx Explorer from the QR code tab. ## Props ## Examples ### Float Composition Lynx does not have a `Float` component, so the same result is created using `position="relative"` on the reference frame and native absolute bottom-center positioning on the external `Box`. ```tsx import IconBellFill from "@karrotmarket/lynx-monochrome-icon/IconBellFill"; import { Box, ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react"; export default function Example() { return ( } /> 알림 설정 ); } ``` ### Solid Variant ```tsx import IconPlusLine from "@karrotmarket/lynx-monochrome-icon/IconPlusLine"; import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react"; export default function Example() { return ( } /> Solid Variant ); } ``` ### Layer Variant ```tsx import IconPlusLine from "@karrotmarket/lynx-monochrome-icon/IconPlusLine"; import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react"; export default function Example() { return ( } /> Layer Variant ); } ``` ### Icon Only With `layout="iconOnly"`, also specify `accessibility-label` for screen readers to read. ```tsx import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill"; import { ContextualFloatingButton, Icon } from "@seed-design/lynx-react"; export default function Example() { return ( } /> ); } ``` ### Loading When tapped, the loading state starts immediately and returns to the original state after 2 seconds. Tapping is disabled during loading. ```tsx import IconPlusLine from "@karrotmarket/lynx-monochrome-icon/IconPlusLine"; import { useState } from "@lynx-js/react"; import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react"; export default function Example() { const [loading, setLoading] = useState(false); function handleTap() { "background only"; setLoading(true); setTimeout(() => setLoading(false), 2000); } return ( } /> 시간이 걸리는 액션 ); } ``` ## Differences from Web Version - **Event handling**: `bindtap` or `main-thread:bindtap` is used instead of `onClick`. - **Rendering elements**: Native `` and `` elements are rendered instead of HTML `