Repository navigation
TooltipTag
Paulo Gomes da Cruz Junior edited this page Aug 27, 2026
·
1 revision
TooltipTag wraps any content with Carbon's Tooltip to show an explanatory label on hover. When no tooltip text is provided, the component renders the children directly, making it usable as a conditional wrapper.
The component normalises primitive children with EmptyValueTag so empty or missing values render a consistent dash placeholder.
- Source:
frontend/src/components/core/Tags/TooltipTag/index.tsx - Tests:
frontend/src/components/core/Tags/TooltipTag/index.unit.test.tsx
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
tooltip |
string |
No | — | Text shown in the tooltip on hover. Omit to render content without a tooltip wrapper. |
children |
ReactNode |
No | — | Content to wrap. Primitive values are passed through EmptyValueTag. Element nodes are rendered inside a span for Carbon Tooltip compatibility. |
align |
TooltipAlignment |
No | 'top' |
Tooltip alignment relative to the trigger. Supports all Carbon PopoverAlignment values including 'top', 'bottom', 'left', 'right', and compound values like 'top-start', 'bottom-end'. |
autoAlign |
boolean |
No | false |
When true, the tooltip automatically adjusts position to stay within the viewport. |
TooltipAlignment includes:
'top' | 'bottom' | 'left' | 'right'
| 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'
| 'left-end' | 'left-start' | 'right-end' | 'right-start'
| 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
| 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top'
- If
tooltipis absent,renderContent()is returned directly with noTooltipwrapper. - If
tooltipis present, content is wrapped in CarbonTooltipwith the providedalignandautoAlign. -
childrenthat are string, number,null, orundefinedare rendered viaEmptyValueTagto handle empty display with a fallback dash. - Element children are wrapped in a
<span>to satisfy Carbon Tooltip's trigger requirements. - Default alignment is
'top'.autoAligndefaults tofalse.
import TooltipTag from '@/components/core/Tags/TooltipTag';
<TooltipTag tooltip="Alder">
<span>AL</span>
</TooltipTag><TooltipTag tooltip="Description">Value</TooltipTag><TooltipTag>Plain value, no tooltip</TooltipTag><TooltipTag tooltip="Bottom aligned" align="bottom">
<span>Content</span>
</TooltipTag>- Conditional tooltip wrapper: renders without
Tooltipwhentooltipis omitted. - Empty value handling: integrates
EmptyValueTagfor primitive children. - Full Carbon alignment support: accepts deprecated and new
PopoverAlignmentvalues. - Auto-align option for viewport-aware positioning.
- Primitive children are always processed by
EmptyValueTag, so numeric zero renders as0and empty strings render as-. - The component does not style the children; visual presentation depends on the child element or surrounding context.
-
autoAlignbehavior is controlled by Carbon's internal positioning logic.
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository