React

Help Bubble

A component that provides users with additional information about a component's state or specific features.

Available since@seed-design/react@0.0.1, @seed-design/css@0.0.1

Installation

npx @seed-design/cli@latest add ui:help-bubble

Props

HelpBubbleTrigger

Prop

Type

titleReact.ReactNode
description?React.ReactNode
showCloseButton?boolean | undefined
children?React.ReactNode
contentProps?SeedHelpBubble.ContentProps | undefined
zIndexOffset?number | undefined

HelpBubbleAnchor

Prop

Type

titleReact.ReactNode
description?React.ReactNode
showCloseButton?boolean | undefined
children?React.ReactNode
contentProps?SeedHelpBubble.ContentProps | undefined
zIndexOffset?number | undefined

Examples

By default, Help Bubble closes when a pointerdown occurs outside the Help Bubble.

Most of the examples below have closeOnInteractOutside={false} set so they do not close even when a pointerdown occurs.

Trigger

Clicking the children of HelpBubbleTrigger opens and closes the Help Bubble.

The children should contain a focusable element like a button.

<HelpBubbleTrigger> sets the aria-haspopup="dialog" attribute and automatically sets the aria-expanded attribute based on the Help Bubble's open state. This attribute is useful for assistive technologies like screen readers.

Anchor

The children of HelpBubbleAnchor are used only for positioning the Help Bubble and do not include click to open/close behavior.

You can use defaultOpen and showCloseButton to control when it opens and closes appropriately, or you can use the open prop in a controlled manner to directly manage the open/closed state.

Close On Interact Outside

When the closeOnInteractOutside prop is set to false, clicking outside the Help Bubble, HelpBubbleTrigger, and HelpBubbleAnchor does not close the Help Bubble. The default is true.

Placement

Flip

Close Button

Description

You can add a description below title using description.

Title Only

Setting Width Manually

content has a default maximum width. Specifying maxWidth in contentProps overrides this default, and specifying none removes the maximum width limit. You can also specify width as an inline style, and if maxWidth is narrower than width, maxWidth will be applied.

Line Breaks

z-index Offset

Table of contents