Toggletip
A small ⓘ button that opens a help bubble on click or tap; the bubble can hold links and is announced to screen readers.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
label | string | — | Accessible name of the button. Defaults to the translatable "More information", unless the icon slot holds
words, which then name the button themselves. |
placement | Placement | top | Preferred side of the button; flips when there is no room. |
open | boolean | false | Visible state. Set it to open or close the bubble from code; that fires show / hide too. |
Slots
| Name | Description |
|---|---|
(default) | The help content: text, links, a short list. |
icon | Replaces the ⓘ inside the button: another icon, or a few words such as "What's this?". |
Events
| Name | Type | Description |
|---|---|---|
show | Event | The bubble opened. |
hide | Event | The bubble closed. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
button | The button that opens and closes the bubble. |
icon | The region wrapping the icon slot inside the button: the ⓘ by default. |
panel | The bubble. |
arrow | The arrow pointing at the button. |
content | The live region wrapping the default slot inside the bubble. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-toggletip--background-color | color | #ffffff | Surface of the bubble. |
--c2-toggletip--color | color | #18181b | Text colour in the bubble. |
--c2-toggletip--border | border | 1px solid #e4e4e7 | |
--c2-toggletip--border-radius | border-radius | 8px | |
--c2-toggletip--box-shadow | box-shadow | 0 8px 24px rgba(24, 24, 27, 0.08) | |
--c2-toggletip--font-size | font-size | 14px | |
--c2-toggletip--font-family | font-family | — | |
--c2-toggletip--line-height | line-height | 1.5 | |
--c2-toggletip--padding-top | padding | 12px | |
--c2-toggletip--padding-right | padding | 14px | |
--c2-toggletip--padding-bottom | padding | 12px | |
--c2-toggletip--padding-left | padding | 14px | |
--c2-toggletip--max-width | pixel | 280px | |
--c2-toggletip--offset | pixel | 6px | Distance between the button and the tip of the arrow. |
--c2-toggletip--transition-duration | time | 120ms | |
--c2-toggletip--enter-transform | transform | scale(0.96) | Start of the enter animation. |
--c2-toggletip__button--size | pixel | 24px | Width and height of the button. |
--c2-toggletip__button--border-radius | border-radius | 999px | |
--c2-toggletip__button--color | color | #71717a | Colour of the ⓘ (or of slotted text). |
--c2-toggletip__button--background-color | color | transparent | |
--c2-toggletip__button__hover--color | color | #18181b | |
--c2-toggletip__button__hover--background-color | color | #f4f4f5 | |
--c2-toggletip__button__expanded--color | color | #0265dc | Colour while the bubble is open. |
--c2-toggletip__button__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-toggletip__button__focus--outline-offset | pixel | 2px | |
--c2-toggletip__icon--size | pixel | 16px | |
--c2-toggletip__arrow--size | pixel | 10px | Side of the arrow square; 0px hides it. |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under toggletip, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
label | More information | — |