|
1 | 1 | @page "/docs/components/tooltip" |
2 | 2 |
|
3 | | -<Seo Canonical="/docs/components/tooltip" Title="Blazorise Tooltip Component" Description="Learn to use and work with the Blazorise Tooltip component, which is useful for conveying information when a user hovers over an element." /> |
| 3 | +<Seo Canonical="/docs/components/tooltip" Title="Blazorise Tooltip Component" Description="Learn to use and work with the Blazorise Tooltip component, which is useful for conveying information when a user hovers, focuses, or taps on an element." /> |
4 | 4 |
|
5 | 5 | <DocsPageTitle Path="Components/Tooltip"> |
6 | 6 | Blazorise Tooltip component |
7 | 7 | </DocsPageTitle> |
8 | 8 |
|
9 | 9 | <DocsPageLead> |
10 | | - Tooltips display additional information based on a specific action. |
| 10 | + Display short, contextual hints on hover, focus, or tap. |
11 | 11 | </DocsPageLead> |
12 | 12 |
|
13 | 13 | <DocsPageParagraph> |
14 | | - The <Code Tag>Tooltip</Code> component is useful for conveying information when a user hovers over an element. When activated, |
15 | | - tooltips display a text label identifying an element, such as a description of its function. |
| 14 | + Use the <Code Tag>Tooltip</Code> component to provide extra context without taking up permanent space in the UI. |
| 15 | + Tooltips are a good fit for icons, buttons, and truncated text that needs a full-value preview. |
16 | 16 | </DocsPageParagraph> |
17 | 17 |
|
| 18 | +<DocsPageSubtitle> |
| 19 | + Overview |
| 20 | +</DocsPageSubtitle> |
| 21 | + |
18 | 22 | <DocsPageParagraph> |
19 | | - <Alert Color="Color.Info" Visible> |
20 | | - <AlertDescription> |
21 | | - Starting with <Strong>v0.9.4</Strong>, Tooltip component is powered by <Blazorise.Link To="https://atomiks.github.io/tippyjs/" Target="Target.Blank">Tippy.js.</Blazorise.Link> |
22 | | - </AlertDescription> |
23 | | - </Alert> |
| 23 | + <UnorderedList> |
| 24 | + <UnorderedListItem> |
| 25 | + <Paragraph><Code>Text</Code> sets the tooltip content.</Paragraph> |
| 26 | + </UnorderedListItem> |
| 27 | + <UnorderedListItem> |
| 28 | + <Paragraph><Code>Placement</Code> controls where the tooltip appears relative to its target.</Paragraph> |
| 29 | + </UnorderedListItem> |
| 30 | + <UnorderedListItem> |
| 31 | + <Paragraph><Code>Trigger</Code> controls which events show the tooltip (hover/focus/click).</Paragraph> |
| 32 | + </UnorderedListItem> |
| 33 | + <UnorderedListItem> |
| 34 | + <Paragraph><Code>Multiline</Code> allows long tooltip text to wrap.</Paragraph> |
| 35 | + </UnorderedListItem> |
| 36 | + <UnorderedListItem> |
| 37 | + <Paragraph><Code>ShowDelay</Code> and <Code>HideDelay</Code> delay showing and hiding (in milliseconds).</Paragraph> |
| 38 | + </UnorderedListItem> |
| 39 | + <UnorderedListItem> |
| 40 | + <Paragraph><Code>Inline</Code> forces the tooltip wrapper to behave as inline-block (useful when wrapping inline content).</Paragraph> |
| 41 | + </UnorderedListItem> |
| 42 | + <UnorderedListItem> |
| 43 | + <Paragraph><Code>TriggerTargetId</Code> applies trigger event listeners to a different element than the tooltip target.</Paragraph> |
| 44 | + </UnorderedListItem> |
| 45 | + </UnorderedList> |
24 | 46 | </DocsPageParagraph> |
25 | 47 |
|
| 48 | +<Alert Color="Color.Warning" Visible> |
| 49 | + <AlertDescription> |
| 50 | + <Strong>Text truncation:</Strong> if you use <Code>TextOverflow.Truncate</Code> on the tooltip target and it renders as an inline element (e.g. <Code Tag>Text</Code>, <Code Tag>Span</Code>, or <Code Tag>span</Code>), set it to <Code>display: inline-block</Code> (or <Code>block</Code>) and apply a width (for example via <Code>max-width</Code>). |
| 51 | + </AlertDescription> |
| 52 | +</Alert> |
| 53 | + |
26 | 54 | <DocsPageSubtitle> |
27 | 55 | Examples |
28 | 56 | </DocsPageSubtitle> |
29 | 57 |
|
30 | 58 | <DocsPageSection> |
31 | 59 | <DocsPageSectionHeader Title="Basic"> |
| 60 | + Wrap any element with a <Code Tag>Tooltip</Code> and set its <Code>Text</Code>. |
32 | 61 | </DocsPageSectionHeader> |
33 | 62 | <DocsPageSectionContent Outlined FullWidth> |
34 | 63 | <BasicTooltipExample /> |
|
37 | 66 | </DocsPageSection> |
38 | 67 |
|
39 | 68 | <DocsPageSection> |
40 | | - <DocsPageSectionHeader Title="Positions"> |
41 | | - You can use one of the following modifiers to change positions of the tooltip: |
| 69 | + <DocsPageSectionHeader Title="Text truncation"> |
| 70 | + Truncate the visible target text, and show the full value on hover via the tooltip. |
| 71 | + <Code>TextOverflow.Truncate</Code> requires the target element to have a width, so make it <Code>Display.InlineBlock</Code> (or apply <Code>style="display: inline-block;"</Code>). |
| 72 | + </DocsPageSectionHeader> |
| 73 | + <DocsPageSectionContent Outlined FullWidth> |
| 74 | + <TooltipTextTruncateExample /> |
| 75 | + </DocsPageSectionContent> |
| 76 | + <DocsPageSectionSource Code="TooltipTextTruncateExample" /> |
| 77 | +</DocsPageSection> |
| 78 | + |
| 79 | +<DocsPageSection> |
| 80 | + <DocsPageSectionHeader Title="Placement"> |
| 81 | + Use the <Code>Placement</Code> parameter to change where the tooltip appears: |
42 | 82 | <UnorderedList> |
43 | 83 | <UnorderedListItem> |
44 | 84 | Top |
|
61 | 101 | </DocsPageSection> |
62 | 102 |
|
63 | 103 | <DocsPageSection> |
64 | | - <DocsPageSectionHeader Title="Different trigger target"> |
65 | | - You may want the tooltip to appear at a different location from its trigger (event listeners) target. |
| 104 | + <DocsPageSectionHeader Title="Separate trigger target"> |
| 105 | + Use <Code>TriggerTargetId</Code> when the tooltip should be positioned relative to one element, but triggered by another. |
66 | 106 | </DocsPageSectionHeader> |
67 | 107 | <DocsPageSectionContent Outlined FullWidth> |
68 | 108 | <TooltipTriggerTargetExample /> |
|
71 | 111 | </DocsPageSection> |
72 | 112 |
|
73 | 113 | <DocsPageSection> |
74 | | - <DocsPageSectionHeader Title="HTML Content"> |
75 | | - Your tooltip can also contain HTML. |
| 114 | + <DocsPageSectionHeader Title="HTML content"> |
| 115 | + <Code>Text</Code> can contain HTML markup. Only use this with trusted strings (or sanitize user-provided content). |
76 | 116 | </DocsPageSectionHeader> |
77 | 117 | <DocsPageSectionContent Outlined FullWidth> |
78 | 118 | <TooltipWithHtmlExample /> |
|
82 | 122 |
|
83 | 123 | <DocsPageSection> |
84 | 124 | <DocsPageSectionHeader Title="Delay"> |
85 | | - Your Tooltip can delay hiding or showing after a trigger. |
| 125 | + Control how quickly the tooltip shows and hides after the trigger event (in milliseconds). |
86 | 126 | </DocsPageSectionHeader> |
87 | 127 | <DocsPageSectionContent Outlined FullWidth> |
88 | 128 | <TooltipDelayExample /> |
|
0 commit comments