Overview
HuxTooltip
component provides additional context when hovering over or long-pressing on widgets. It automatically adapts to light and dark themes and provides various positioning and styling options.
Basic Usage
The simplest way to use a tooltip is to wrap any widget withHuxTooltip
:
Variants
Standard Tooltip
The basic tooltip with customizable styling:
Tooltip with Icon
For enhanced visual context, add an icon parameter toHuxTooltip
.

Customization
Colors
Customize the tooltip appearance with your own colors:Positioning
Control where the tooltip appears relative to the child:Timing
Adjust when and how long the tooltip appears:Advanced Styling
For complete control over the tooltip appearance:Props
HuxTooltip
Prop | Type | Default | Description |
---|---|---|---|
message | String | required | The text to display in the tooltip |
child | Widget | required | The widget below this tooltip |
backgroundColor | Color? | Theme surface | Background color of the tooltip |
textColor | Color? | Theme text | Text color of the tooltip |
preferBelow | bool | true | Whether to prefer showing below the child |
excludeFromSemantics | bool | false | Whether to exclude from semantics tree |
verticalOffset | double | 10.0 | Vertical offset from the child |
waitDuration | Duration | 500ms | How long to wait before showing |
showDuration | Duration | 3000ms | How long to show the tooltip |
decoration | Decoration? | Default theme | Custom decoration for the tooltip |
textStyle | TextStyle? | Default theme | Custom text style |
height | double? | Auto | Height of the tooltip |
padding | EdgeInsetsGeometry? | 12x8 | Padding inside the tooltip |
margin | EdgeInsetsGeometry? | 8 | Margin around the tooltip |
richMessage | InlineSpan? | null | Rich text message (overrides message) |
HuxTooltip Icon Parameters
Prop | Type | Default | Description |
---|---|---|---|
icon | IconData? | null | The icon to display alongside the message (rendered as an Icon widget) |
iconColor | Color? | Theme text color | Color of the icon |
iconSize | double | 16.0 | Size of the icon |
Examples
Provide context for form inputs:Button Explanations
Explain button actions:Navigation Hints
Guide users through complex interfaces:Best Practices
Content Guidelines
- Keep messages concise: Tooltips should be brief and to the point
- Use clear language: Avoid technical jargon unless necessary
- Provide value: Only show tooltips when they add meaningful context
Accessibility
- Semantic content: Tooltips are automatically included in the accessibility tree
- Keyboard navigation: Tooltips work with keyboard navigation
- Screen readers: Content is properly announced to assistive technologies
Performance
- Lazy loading: Tooltips only render when needed
- Efficient positioning: Smart positioning algorithms minimize layout calculations
- Memory management: Proper cleanup when tooltips are dismissed
Theme Integration
- Automatic adaptation: Tooltips automatically adapt to light/dark themes
- Consistent styling: Uses Hux design tokens for consistent appearance
- Customizable: Override theme colors when needed for specific use cases