Tooltip
a primitive for creating Tooltip component.
- View ARIA pattern W3C
- View source code GitHub
- View code coverage v8-coverage
- View type documentation typedoc
Anatomy
API Reference
Parameters
createTooltipTriggerState [TooltipTriggerStateArguments]
Name | Type | Default | Description |
---|---|---|---|
closeDelay | number | 500 | The delay time for the tooltip to close. |
defaultOpen | boolean | - | Whether the overlay is open by default (uncontrolled). |
delay | number | 1500 | The delay time for the tooltip to show up. |
isOpen | boolean | - | Whether the overlay is open by default (controlled). |
onOpenChange | (isOpen: boolean) => void | - | Handler that is called when the overlay's open state changes. |
createTooltipTrigger [TooltipTriggerArguments]
Name | Type | Default | Description |
---|---|---|---|
isDisabled | boolean | false | Whether the tooltip should be disabled, independent from the trigger. |
trigger | 'focus' | undefined | - | By default, opens for both focus and hover. Can be made to open only for focus. |
Return value
createTooltipTriggerState [TooltipTriggerState]
Name | Type | Description |
---|---|---|
close * | (immediate?: boolean) => void | Hides the tooltip. |
isOpen * | boolean | Whether the tooltip is currently showing. |
open * | (immediate?: boolean) => void | Shows the tooltip. By default, the tooltip becomes visible after a delay depending on a global warmup timer. The `immediate` option shows the tooltip immediately instead. |
createTooltipTrigger [AriaTooltipTrigger]
Name | Type | Description |
---|---|---|
triggerProps * | JSX.HTMLAttributes<any> | Props for the trigger element. |
tooltipProps * | JSX.HTMLAttributes<any> | Props for the tooltip container element. |
createTooltip [AriaTooltip]
Name | Type | Description |
---|---|---|
tooltipProps * | JSX.HTMLAttributes<any> | Props for the tooltip container element. |
Example
Tooltip