Toggle Tip
A small tip that opens when the user clicks or taps an info button.
Shortcut and parts
ToggleTip: pass the tip as content and wrap the trigger. InfoTip adds a
small info button as the trigger.
For full control, use the Popover parts: Popover.Root,
Popover.Trigger, Popover.Positioner, and Popover.Content.
With Parts builds the same tip both ways.
Usage
import { InfoTip, ToggleTip } from '@leverui/components';
<ToggleTip content="...">{(getProps) => <button {...getProps()} />}</ToggleTip>
Examples
Info Tip
Use the InfoTip component to display an info tip. This component renders an icon button with an info icon by default.
Useful for landing pages to display additional information about a feature.
File size: 1.45 kB
Sizes
The toggle tip supports xs, sm, md, and lg size variants. Pass the size prop to both the component and the button to scale it consistently.
Arrow
Set showArrow to display a directional arrow pointing from the popover content to the trigger element.
Close on Escape
By default (true), pressing the Escape key closes the toggle tip. Set to false to keep it open on Escape.
Close on Interact Outside
By default (true), clicking outside the toggle tip closes it. Set to false to allow outside interaction without closing.
With Parts
Both buttons show the same tip. The first uses the ToggleTip shortcut; the second composes the Popover parts for full control.
Guides
Trigger
The trigger is a Solid render function. Spread getProps() on your element to
keep the open state, keyboard and focus behavior, and the accessible link to
the tip.
Give an icon-only trigger an accessible name that does not change. Use
contentProps to give Popover.Content its own name or title.
Portal
Set portalled={false} to render the content in place, or pass portalRef to
render it inside another element.
Props
Root
| Prop | Default | Type | Description |
|---|---|---|---|
autoFocus | true | boolean | Focus the first focusable element on open. |
closeOnEscape | true | boolean | Close on Escape. |
closeOnInteractOutside | true | boolean | Close on click outside. |
portalled | true | boolean | Render the content in a Portal. Tab order follows the content. |
restoreFocus | true | boolean | Return focus to the previous element on close. |
size | 'md' | 'xs' | 'sm' | 'md' | 'lg' | Tip size. |
unstyled | — | boolean | Turn off the default styles. |
defaultOpen | — | boolean | Start open, when uncontrolled. |
defaultTriggerValue | — | string | Starting trigger value, when uncontrolled. |
finalFocusEl | — | () => MaybeElement | Returns the element to focus on close. |
id | — | string | Unique id. |
ids | — | Element ID map | Ids of the popover elements. |
immediate | — | boolean | Apply present changes right away, not on the next frame. |
initialFocusEl | — | () => HTMLElement | null | Returns the element to focus on open. |
lazyMount | false | boolean | Render the content only once the popover first opens. |
modal | false | boolean | Block interaction and scrolling outside, hide the rest from screen readers, and trap focus. |
onEscapeKeyDown | — | (event: KeyboardEvent) => void | Called on Escape. |
onExitComplete | — | VoidFunction | Called when the closing animation ends. |
onFocusOutside | — | (event: FocusOutsideEvent) => void | Called when focus moves outside the popover. |
onInteractOutside | — | (event: InteractOutsideEvent) => void | Called on interaction outside the popover. |
onOpenChange | — | (details: OpenChangeDetails) => void | Called when the popover opens or closes. |
onPointerDownOutside | — | (event: PointerDownOutsideEvent) => void | Called on pointer down outside the popover. |
onRequestDismiss | — | (event: LayerDismissEvent) => void | Called when this layer closes because a parent layer closed. |
onTriggerValueChange | — | (details: TriggerValueChangeDetails) => void | Called when the trigger value changes. |
open | — | boolean | Open state, when you control it. |
persistentElements | — | (() => Element | null)[] | Elements that keep pointer events and do not close the popover. |
positioning | — | PositioningOptions | Placement options for the content. |
present | — | boolean | Present state, when you control it. |
skipAnimationOnMount | false | boolean | Skip the animation on the first render. |
translations | — | IntlTranslations | Translated text for assistive technology. |
triggerValue | — | string | Trigger value, when you control it. |
unmountOnExit | false | boolean | Remove the content from the DOM on close. |
ToggleTip also takes content, showArrow, portalRef, and contentProps.
InfoTip adds buttonProps, which go to its icon button.