Contextual Floating Button A button that floats on the screen and appears only in specific situations to provide auxiliary actions.
@seed-design/lynx-react@0.8.0, @seed-design/lynx-css@0.12.0
npm install @seed-design/lynx-react @seed-design/lynx-css pnpm add @seed-design/lynx-react @seed-design/lynx-css yarn add @seed-design/lynx-react @seed-design/lynx-css bun add @seed-design/lynx-react @seed-design/lynx-css
import IconBellFill from "@karrotmarket/lynx-monochrome-icon/IconBellFill" ;
import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react" ;
export default function Example () {
return (
< ContextualFloatingButton >
< PrefixIcon icon = {< IconBellFill />} />
알림 설정
</ ContextualFloatingButton >
);
}
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined
bindtap?EventHandler < BaseTouchEvent < Target >> | undefined
main-thread:bindtap?EventHandler < BaseTouchEvent < Element >> | undefined
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.
import IconBellFill from "@karrotmarket/lynx-monochrome-icon/IconBellFill" ;
import { Box, ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react" ;
export default function Example () {
return (
< Box
position = "relative"
width = "300px"
height = "500px"
borderWidth = { 1 }
borderColor = "stroke.neutralMuted"
>
< Box position = "absolute" width = "full" bottom = "x4" display = "flex" justifyContent = "center" >
< ContextualFloatingButton >
< PrefixIcon icon = {< IconBellFill />} />
알림 설정
</ ContextualFloatingButton >
</ Box >
</ Box >
);
}
import IconPlusLine from "@karrotmarket/lynx-monochrome-icon/IconPlusLine" ;
import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react" ;
export default function Example () {
return (
< ContextualFloatingButton variant = "solid" >
< PrefixIcon icon = {< IconPlusLine />} />
Solid Variant
</ ContextualFloatingButton >
);
}
import IconPlusLine from "@karrotmarket/lynx-monochrome-icon/IconPlusLine" ;
import { ContextualFloatingButton, PrefixIcon } from "@seed-design/lynx-react" ;
export default function Example () {
return (
< ContextualFloatingButton variant = "layer" >
< PrefixIcon icon = {< IconPlusLine />} />
Layer Variant
</ ContextualFloatingButton >
);
}
With layout="iconOnly", also specify accessibility-label for screen readers to read.
import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill" ;
import { ContextualFloatingButton, Icon } from "@seed-design/lynx-react" ;
export default function Example () {
return (
< ContextualFloatingButton layout = "iconOnly" accessibility-label = "추가" >
< Icon icon = {< IconPlusFill />} />
</ ContextualFloatingButton >
);
}
When tapped, the loading state starts immediately and returns to the original state after 2 seconds. Tapping is disabled during loading.
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 (
< ContextualFloatingButton loading = {loading} bindtap = {handleTap}>
< PrefixIcon icon = {< IconPlusLine />} />
시간이 걸리는 액션
</ ContextualFloatingButton >
);
}
Event handling : bindtap or main-thread:bindtap is used instead of onClick.
Rendering elements : Native <view> and <text> elements are rendered instead of HTML <button>. HTML form props and asChild are not supported.
Accessibility : Native accessibility-label is used instead of aria-label.
Icons : Native icon assets are passed as PrefixIcon or Icon child slots instead of web SVG. Recipe colors are synchronized with native icon tint.
Loading : Both platforms overlay a spinner as absolute and hide content to maintain button width. Lynx blocks taps during loading, but React does not block onClick with loading alone.
Scale Feedback : The root's transform is owned by the Scale Feedback hook. When you need to adjust position with transform, apply it to an external wrapper, not the button root.