A speech bubble that provides users with additional information about a component's state or specific features.
@seed-design/lynx-react@0.8.0, @seed-design/lynx-css@0.12.0
import "./styles" ;
import IconILowercaseSerifCircleFill from "@karrotmarket/lynx-monochrome-icon/IconILowercaseSerifCircleFill" ;
import { ActionButton, Icon, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleTrigger } from "@/components/ui/help-bubble" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" align = "center" justify = "center" >
< HelpBubbleTrigger defaultOpen title = "아래 버튼이나 바깥 영역을 클릭해서 닫아보세요." >
< ActionButton variant = "ghost" size = "small" layout = "iconOnly" accessibility-label = "도움말" >
< Icon icon = {< IconILowercaseSerifCircleFill />} />
</ ActionButton >
</ HelpBubbleTrigger >
</ VStack >
</ view >
);
}
npx @seed-design/cli@latest add ui:help-bubble pnpm dlx @seed-design/cli@latest add ui:help-bubble yarn dlx @seed-design/cli@latest add ui:help-bubble bun x @seed-design/cli@latest add ui:help-bubble
Install dependencies
npm install @karrotmarket/lynx-monochrome-icon @seed-design/lynx-react yarn add @karrotmarket/lynx-monochrome-icon @seed-design/lynx-react pnpm add @karrotmarket/lynx-monochrome-icon @seed-design/lynx-react bun add @karrotmarket/lynx-monochrome-icon @seed-design/lynx-react Copy the code below and paste it in /**
* @file ui:help-bubble
* @requires @seed-design/lynx-react@>=0.8.0 <1.0.0
* @requires @seed-design/lynx-css@>=0.12.0 <1.0.0
* @requires @karrotmarket/lynx-monochrome-icon@>=1.20.0 <2.0.0
**/
import IconXmarkLine from "@karrotmarket/lynx-monochrome-icon/IconXmarkLine" ;
import * as React from "@lynx-js/react" ;
import { HelpBubble as SeedHelpBubble, Icon } from "@seed-design/lynx-react" ;
interface HelpBubbleProps extends Omit < SeedHelpBubble . RootProps , "children" > {
title : React . ReactNode ;
description ?: React . ReactNode ;
showCloseButton ?: boolean ;
children ?: React . ReactNode ;
contentProps ?: SeedHelpBubble . ContentProps ;
zIndexOffset ?: number ;
}
export interface HelpBubbleTriggerProps extends HelpBubbleProps {}
/**
* 트리거와 말풍선의 기본 슬롯을 조립합니다. 자식은 native `view`로 감싸므로 `asChild`를
* 지원하지 않습니다.
*
* @see https://crispy.carrot-soft.tech/lynx/components/help-bubble
*/
export const HelpBubbleTrigger = React. forwardRef < unknown , HelpBubbleTriggerProps >(
(
{
showCloseButton = false ,
title,
description,
contentProps,
zIndexOffset,
children,
... rootProps
},
ref,
) => {
return (
< SeedHelpBubble.Root { ... rootProps}>
< SeedHelpBubble.Trigger ref = {ref}>
< view >{children}</ view >
</ SeedHelpBubble.Trigger >
< HelpBubbleContent
title = {title}
description = {description}
showCloseButton = {showCloseButton}
contentProps = {contentProps}
zIndexOffset = {zIndexOffset}
/>
</ SeedHelpBubble.Root >
);
},
);
HelpBubbleTrigger.displayName = "HelpBubbleTrigger" ;
export interface HelpBubbleAnchorProps extends HelpBubbleProps {}
/**
* 위치 기준점과 말풍선의 기본 슬롯을 조립합니다. Anchor는 탭으로 열고 닫지 않습니다.
*
* @see https://crispy.carrot-soft.tech/lynx/components/help-bubble
*/
export const HelpBubbleAnchor = React. forwardRef < unknown , HelpBubbleAnchorProps >(
(
{
showCloseButton = false ,
title,
description,
contentProps,
zIndexOffset,
children,
... rootProps
},
ref,
) => {
return (
< SeedHelpBubble.Root { ... rootProps}>
< SeedHelpBubble.Anchor ref = {ref}>
< view >{children}</ view >
</ SeedHelpBubble.Anchor >
< HelpBubbleContent
title = {title}
description = {description}
showCloseButton = {showCloseButton}
contentProps = {contentProps}
zIndexOffset = {zIndexOffset}
/>
</ SeedHelpBubble.Root >
);
},
);
HelpBubbleAnchor.displayName = "HelpBubbleAnchor" ;
interface HelpBubbleContentProps {
title : React . ReactNode ;
description ?: React . ReactNode ;
showCloseButton : boolean ;
contentProps ?: SeedHelpBubble . ContentProps ;
zIndexOffset ?: number ;
}
function HelpBubbleContent ({
title ,
description ,
showCloseButton ,
contentProps ,
zIndexOffset ,
} : HelpBubbleContentProps ) {
return (
< SeedHelpBubble.Positioner zIndexOffset = {zIndexOffset}>
< SeedHelpBubble.Content { ... contentProps}>
< SeedHelpBubble.Arrow >
< SeedHelpBubble.ArrowTip />
</ SeedHelpBubble.Arrow >
< SeedHelpBubble.Body >
< SeedHelpBubble.Title >{title}</ SeedHelpBubble.Title >
{description != null ? (
< SeedHelpBubble.Description >{description}</ SeedHelpBubble.Description >
) : null }
</ SeedHelpBubble.Body >
{showCloseButton ? (
< SeedHelpBubble.CloseButton accessibility-label = "닫기" >
< Icon
icon = {< IconXmarkLine color = "var(--seed-color-fg-neutral-inverted)" />}
size = { 14 }
color = "fg.neutralInverted"
/>
</ SeedHelpBubble.CloseButton >
) : null }
</ SeedHelpBubble.Content >
</ SeedHelpBubble.Positioner >
);
}
/**
* This file is a snippet from Crispy, helping you get started quickly with @seed-design/* packages.
* You can extend this snippet however you want.
*/
The installed snippet assembles the positioning anchor, speech bubble content, arrow, and optional close button together with HelpBubbleTrigger and HelpBubbleAnchor.
import IconILowercaseSerifCircleFill from "@karrotmarket/lynx-monochrome-icon/IconILowercaseSerifCircleFill" ;
import { ActionButton, Icon } from "@seed-design/lynx-react" ;
import { HelpBubbleTrigger } from "@/components/ui/help-bubble" ;
export function App () {
return (
< HelpBubbleTrigger defaultOpen title = "Check additional information." >
< ActionButton variant = "ghost" size = "small" layout = "iconOnly" accessibility-label = "Help" >
< Icon icon = {< IconILowercaseSerifCircleFill />} />
</ ActionButton >
</ HelpBubbleTrigger >
);
}
HelpBubbleTrigger opens and closes the speech bubble when a child is tapped.
HelpBubbleAnchor creates only the positioning anchor. You can set the initial open state with defaultOpen, or directly control the open state with open and onOpenChange.
The default placement is "top". You can adjust the position with placement, flip, gutter, overflowPadding, arrowPadding.
Specifying showCloseButton adds a close button with a default close icon.
The default value of contentProps.maxWidth is 280px, and you can remove the maximum width limit with "none". When contentProps.style.width is also specified, if maxWidth is narrower, maxWidth is applied.
zIndexOffset adds to the Positioner's default z-index 99.
titleReact.ReactNode
description?React.ReactNode
showCloseButton?boolean | undefined
children?React.ReactNode
contentProps?SeedHelpBubble.ContentProps | undefined
zIndexOffset?number | undefined
open?boolean | undefined
defaultOpen?boolean | undefined
onOpenChange?(( open : boolean ) => void ) | undefined
style?CSSProperties | undefined
className?string | undefined
titleReact.ReactNode
description?React.ReactNode
showCloseButton?boolean | undefined
children?React.ReactNode
contentProps?SeedHelpBubble.ContentProps | undefined
zIndexOffset?number | undefined
style?CSSProperties | undefined
className?string | undefined
open?boolean | undefined
defaultOpen?boolean | undefined
onOpenChange?(( open : boolean ) => void ) | undefined
Tapping HelpBubbleTrigger opens and closes the speech bubble. This example shows both an uncontrolled Trigger that is initially open and a Trigger that controls state with open and onOpenChange. In both cases, you can close with the close button.
import "./styles" ;
import { useState } from "@lynx-js/react" ;
import { ActionButton, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleTrigger } from "@/components/ui/help-bubble" ;
import { Switch } from "@/components/ui/switch" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
const [ isControlledHelpBubbleOpen , setIsControlledHelpBubbleOpen ] = useState ( true );
function handleControlledOpenChange ( nextOpen : boolean ) {
"background only" ;
setIsControlledHelpBubbleOpen (nextOpen);
}
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" gap = "x16" align = "center" justify = "center" >
< HelpBubbleTrigger
defaultOpen
title = "Trigger, uncontrolled"
description = "클릭으로 열고 닫는 동작이 있는 트리거입니다."
placement = "right"
showCloseButton
closeOnInteractOutside = { false }
>
< ActionButton variant = "neutralSolid" >토글</ ActionButton >
</ HelpBubbleTrigger >
< VStack gap = "spacingY.componentDefault" align = "center" >
< HelpBubbleTrigger
open = {isControlledHelpBubbleOpen}
onOpenChange = {handleControlledOpenChange}
title = "Trigger, controlled"
description = "클릭으로 열고 닫는 동작이 있는 트리거입니다."
placement = "right"
showCloseButton
closeOnInteractOutside = { false }
>
< ActionButton variant = "neutralSolid" >토글</ ActionButton >
</ HelpBubbleTrigger >
< Switch
size = "24"
tone = "neutral"
label = "열림"
checked = {isControlledHelpBubbleOpen}
onCheckedChange = {handleControlledOpenChange}
/>
</ VStack >
</ VStack >
</ view >
);
}
HelpBubbleAnchor is an element like an avatar that only positions the speech bubble and does not open/close by tapping. The open state of uncontrolled Anchor using defaultOpen and controlled Anchor using open and onOpenChange are changed by the close button and open Switch respectively.
import "./styles" ;
import { useState } from "@lynx-js/react" ;
import { Box, Text, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
import { Switch } from "@/components/ui/switch" ;
const AVATAR_SRC = "https://avatars.githubusercontent.com/u/54893898?v=4" ;
function Avatar () {
const [ hasImageError , setHasImageError ] = useState ( false );
function handleImageError () {
"background only" ;
setHasImageError ( true );
}
return (
< Box
width = "64px"
height = "64px"
alignItems = "center"
justifyContent = "center"
overflowX = "hidden"
overflowY = "hidden"
borderRadius = "full"
bg = "bg.neutralWeak"
>
{hasImageError ? (
< Text textStyle = "t2Bold" >L</ Text >
) : (
< image
src = { AVATAR_SRC }
mode = "aspectFill"
style = {{ width: "64px" , height: "64px" }}
binderror = {handleImageError}
/>
)}
</ Box >
);
}
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
const [ isControlledHelpBubbleOpen , setIsControlledHelpBubbleOpen ] = useState ( true );
function handleControlledOpenChange ( nextOpen : boolean ) {
"background only" ;
setIsControlledHelpBubbleOpen (nextOpen);
}
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" gap = "x16" align = "center" justify = "center" >
< HelpBubbleAnchor
defaultOpen
title = "Anchor, uncontrolled"
description = "클릭으로 열고 닫는 동작 없이 위치만 지정합니다."
placement = "right"
showCloseButton
closeOnInteractOutside = { false }
>
< Avatar />
</ HelpBubbleAnchor >
< VStack gap = "spacingY.componentDefault" align = "center" >
< HelpBubbleAnchor
open = {isControlledHelpBubbleOpen}
onOpenChange = {handleControlledOpenChange}
title = "Anchor, controlled"
description = "클릭으로 열고 닫는 동작 없이 위치만 지정합니다."
placement = "right"
showCloseButton
closeOnInteractOutside = { false }
>
< Avatar />
</ HelpBubbleAnchor >
< Switch
size = "24"
tone = "neutral"
label = "열림"
checked = {isControlledHelpBubbleOpen}
onCheckedChange = {handleControlledOpenChange}
/>
</ VStack >
</ VStack >
</ view >
);
}
The default value of closeOnInteractOutside is true. On native, when true, the first tap outside the speech bubble closes only the bubble and is not passed to elements below. When false, the speech bubble remains open and outside taps are passed directly to elements below.
import "./styles" ;
import { ActionButton, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleTrigger } from "@/components/ui/help-bubble" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" gap = "x16" align = "center" justify = "center" >
< HelpBubbleTrigger
defaultOpen
title = "This closes on interactions outside"
placement = "right"
closeOnInteractOutside
>
< ActionButton variant = "neutralSolid" >토글</ ActionButton >
</ HelpBubbleTrigger >
< HelpBubbleTrigger
defaultOpen
title = "This does not close on interactions outside"
placement = "right"
closeOnInteractOutside = { false }
>
< ActionButton variant = "neutralSolid" >토글</ ActionButton >
</ HelpBubbleTrigger >
</ VStack >
</ view >
);
}
Use placement to position the speech bubble in 12 directions around the reference element. This example shows each placement in open state and maintains the direction specified with flip={false}.
import "./styles" ;
import IconSparkle2 from "@karrotmarket/lynx-multicolor-icon/IconSparkle2" ;
import { Box, HStack, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor, type HelpBubbleAnchorProps } from "@/components/ui/help-bubble" ;
function PlacementAnchor ({
placement ,
} : {
placement : NonNullable < HelpBubbleAnchorProps [ "placement" ]>;
}) {
return (
< Box width = "200px" alignItems = "center" >
< HelpBubbleAnchor
open
flip = { false }
placement = {placement}
title = {placement}
description = "est tempor aute"
>
< IconSparkle2 />
</ HelpBubbleAnchor >
</ Box >
);
}
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< scroll-view scroll-orientation = "horizontal" style = {{ width: "100%" , height: "600px" }}>
< VStack width = "full" minWidth = "920px" gap = "80px" px = "80px" py = "80px" >
< HStack justify = "center" gap = "80px" >
< PlacementAnchor placement = "top-end" />
< PlacementAnchor placement = "top" />
< PlacementAnchor placement = "top-start" />
</ HStack >
< HStack justify = "center" gap = "80px" >
< PlacementAnchor placement = "left-end" />
< Box width = "200px" />
< PlacementAnchor placement = "right-end" />
</ HStack >
< HStack justify = "center" gap = "80px" >
< PlacementAnchor placement = "left" />
< Box width = "200px" />
< PlacementAnchor placement = "right" />
</ HStack >
< HStack justify = "center" gap = "80px" >
< PlacementAnchor placement = "left-start" />
< Box width = "200px" />
< PlacementAnchor placement = "right-start" />
</ HStack >
< HStack justify = "center" gap = "80px" >
< PlacementAnchor placement = "bottom-end" />
< PlacementAnchor placement = "bottom" />
< PlacementAnchor placement = "bottom-start" />
</ HStack >
</ VStack >
</ scroll-view >
</ view >
);
}
Specifying flip={false} prevents the speech bubble from changing direction even if there is insufficient space at screen boundaries.
import "./styles" ;
import IconSparkle2 from "@karrotmarket/lynx-multicolor-icon/IconSparkle2" ;
import { VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" align = "center" justify = "center" >
< HelpBubbleAnchor
open
flip = { false }
title = "Flip"
description = "Flip을 끄면 화면 경계에서 방향이 바뀌지 않아요."
>
< IconSparkle2 />
</ HelpBubbleAnchor >
</ VStack >
</ view >
);
}
You can add a close button to the speech bubble with showCloseButton. Tapping the close button closes the bubble, and tapping Trigger again reopens it.
import "./styles" ;
import { ActionButton, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleTrigger } from "@/components/ui/help-bubble" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" align = "center" justify = "center" >
< HelpBubbleTrigger
defaultOpen
showCloseButton
title = "Close Button"
description = "showCloseButton으로 닫기 버튼을 추가할 수 있어요."
>
< ActionButton variant = "neutralSolid" >토글</ ActionButton >
</ HelpBubbleTrigger >
</ VStack >
</ view >
);
}
You can add a description below title by using description.
import "./styles" ;
import IconSparkle2 from "@karrotmarket/lynx-multicolor-icon/IconSparkle2" ;
import { VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" align = "center" justify = "center" >
< HelpBubbleAnchor open title = "제목" description = "제목 아래에 부연 설명을 덧붙일 수 있어요." >
< IconSparkle2 />
</ HelpBubbleAnchor >
</ VStack >
</ view >
);
}
You can pass only title without description.
import "./styles" ;
import IconSparkle2 from "@karrotmarket/lynx-multicolor-icon/IconSparkle2" ;
import { VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "320px" align = "center" justify = "center" >
< HelpBubbleAnchor open title = "Title Only" >
< IconSparkle2 />
</ HelpBubbleAnchor >
</ VStack >
</ view >
);
}
Content has a default maximum width. You can override this value with contentProps.maxWidth, and remove the maximum width limit with "none". When contentProps.style.width is also specified, if maxWidth is narrower, maxWidth takes precedence.
import "./styles" ;
import { useState } from "@lynx-js/react" ;
import { Text, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
import { SegmentedControl, SegmentedControlItem } from "@/components/ui/segmented-control" ;
const WIDTH_OPTIONS = [ "200px" , "300px" , "unset" ] as const ;
const MAX_WIDTH_OPTIONS = [ "200px" , "400px" , "none" ] as const ;
type Width = ( typeof WIDTH_OPTIONS )[ number ];
type MaxWidth = ( typeof MAX_WIDTH_OPTIONS )[ number ];
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
const [ width , setWidth ] = useState < Width >( "unset" );
const [ maxWidth , setMaxWidth ] = useState < MaxWidth >( "400px" );
function handleWidthChange ( nextWidth : string ) {
"background only" ;
setWidth (nextWidth as Width );
}
function handleMaxWidthChange ( nextMaxWidth : string ) {
"background only" ;
setMaxWidth (nextMaxWidth as MaxWidth );
}
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "400px" p = "x10" align = "center" justify = "center" >
< HelpBubbleAnchor
open
title = "Pariatur aliqua commodo eu Lorem minim anim. Lorem ipsum voluptate eu duis eiusmod consequat."
contentProps = {{ maxWidth, style: { width } }}
>
< VStack gap = "x4" align = "center" >
< VStack gap = "x1" align = "center" >
< Text >width</ Text >
< SegmentedControl
value = {width}
onValueChange = {handleWidthChange}
accessibility-label = "width"
>
{ WIDTH_OPTIONS . map (( option ) => (
< SegmentedControlItem key = {option} value = {option}>
{option}
</ SegmentedControlItem >
))}
</ SegmentedControl >
</ VStack >
< VStack gap = "x1" align = "center" >
< Text >maxWidth</ Text >
< SegmentedControl
value = {maxWidth}
onValueChange = {handleMaxWidthChange}
accessibility-label = "maxWidth"
>
{ MAX_WIDTH_OPTIONS . map (( option ) => (
< SegmentedControlItem key = {option} value = {option}>
{option}
</ SegmentedControlItem >
))}
</ SegmentedControl >
</ VStack >
</ VStack >
</ HelpBubbleAnchor >
</ VStack >
</ view >
);
}
React's <br /> is converted to native <text> children and "\n" in Lynx title. You can also pass line break characters in strings to title.
import "./styles" ;
import IconSparkle2 from "@karrotmarket/lynx-multicolor-icon/IconSparkle2" ;
import { HStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
const explicitLineBreakTitle = (
< text >
{ "Breaking" }
{ " \n " }
{ "lines" }
{ " \n " }
{ "using" }
{ " \n " }
{ "`<br />`s" }
</ text >
);
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< HStack width = "full" height = "320px" gap = "x16" align = "center" justify = "center" >
< HelpBubbleAnchor open title = {explicitLineBreakTitle}>
< IconSparkle2 />
</ HelpBubbleAnchor >
< HelpBubbleAnchor open title = { "Breaking \n lines \n using \n newlines" }>
< IconSparkle2 />
</ HelpBubbleAnchor >
</ HStack >
</ view >
);
}
Use zIndexOffset to add a value to the Positioner's default z-index 99. This example changes the offset with SegmentedControl and checks the current z-index of the speech bubble.
import "./styles" ;
import { useState } from "@lynx-js/react" ;
import { Box, HStack, Text, VStack, useSeedClassName } from "@seed-design/lynx-react" ;
import { HelpBubbleAnchor } from "@/components/ui/help-bubble" ;
import { SegmentedControl, SegmentedControlItem } from "@/components/ui/segmented-control" ;
const AVATAR_SRC = "https://avatars.githubusercontent.com/u/54893898?v=4" ;
const OFFSET_OPTIONS = [ "0" , "1" , "2" , "3" , "4" , "5" ] as const ;
function Avatar () {
const [ hasImageError , setHasImageError ] = useState ( false );
function handleImageError () {
"background only" ;
setHasImageError ( true );
}
return (
< Box
width = "64px"
height = "64px"
alignItems = "center"
justifyContent = "center"
overflowX = "hidden"
overflowY = "hidden"
borderRadius = "full"
bg = "bg.neutralWeak"
>
{hasImageError ? (
< Text textStyle = "t2Bold" >L</ Text >
) : (
< image
src = { AVATAR_SRC }
mode = "aspectFill"
style = {{ width: "64px" , height: "64px" }}
binderror = {handleImageError}
/>
)}
</ Box >
);
}
export default function Example () {
const seedClassName = useSeedClassName ({ colorMode: "system" });
const [ zIndexOffset , setZIndexOffset ] = useState ( 5 );
function handleOffsetChange ( nextOffset : string ) {
"background only" ;
setZIndexOffset ( Number (nextOffset));
}
return (
< view className = { `${ seedClassName } docs-lynx-help-bubble-root` }>
< VStack width = "full" height = "480px" p = "x5" gap = "x8" align = "center" justify = "center" >
< HStack gap = "x2" >
{Array. from ({ length: 5 }, ( _ , index ) => (
< Box
key = {index}
width = "64px"
height = "64px"
borderRadius = "r2"
alignItems = "center"
justifyContent = "center"
bg = "bg.neutralWeak"
borderColor = "stroke.neutralWeak"
borderWidth = { 1 }
zIndex = {index + 100 }
>
< Text >{index + 100 }</ Text >
</ Box >
))}
</ HStack >
< HelpBubbleAnchor
defaultOpen
title = { `default: 99, current: ${ 99 + zIndexOffset }` }
description = "Et ullamco laborum voluptate ipsum labore ea nostrud sunt ipsum."
zIndexOffset = {zIndexOffset}
closeOnInteractOutside = { false }
>
< Avatar />
</ HelpBubbleAnchor >
< VStack gap = "x1" align = "center" >
< SegmentedControl
value = { String (zIndexOffset)}
onValueChange = {handleOffsetChange}
accessibility-label = "zIndexOffset"
>
{ OFFSET_OPTIONS . map (( option ) => (
< SegmentedControlItem key = {option} value = {option}>
{option}
</ SegmentedControlItem >
))}
</ SegmentedControl >
< HStack width = "full" justify = "spaceBetween" >
< Text >0</ Text >
< Text >5</ Text >
</ HStack >
</ VStack >
</ VStack >
</ view >
);
}
Lynx's Trigger and Anchor wrap children in native view. They do not provide DOM asChild, HTML ARIA attributes, keyboard focus, ESC closing, or portal. Required accessibility is ensured through Lynx's accessibility-* props and the host's native accessibility flow.
When closeOnInteractOutside is true, the first outside tap closes only the speech bubble and is not passed to elements below. When false, the speech bubble remains open and outside taps are passed to elements below.
Positioner is a fixed native view, not a portal or fullscreen overlay. Use zIndexOffset to adjust the z-index order with sibling elements on the same screen.