Sablon:IconText/doc
More actions
Renders an inline icon and text pair: a small icon followed by a plain text label, neither of which links anywhere. The icon is inert decoration and the label is plain text. Suited to compact inline metadata such as a clock beside a duration, a map pin beside a location, or a status glyph beside a label. Wraps Module:IconText; see the module page for rendering details. For an icon and label that both link to a page, use Template:IconLink.
Usage
The first positional argument is the text label; icon is the file name of the leading glyph. size sets the icon size; class appends a CSS class to the root span.
| Wikitext | Result |
|---|---|
{{IconText|5 minutes|icon=CdxIconClock.svg}}
|
|
{{IconText|Stanton|icon=CdxIconMapPin.svg}}
|
|
{{IconText|Warning|icon=CdxIconError.svg|size=16px}}
|
|
{{IconText|5 minutes|icon=CdxIconClock.svg|mask=yes}}
|
Parameters
Renders an inline icon and text pair: a small icon followed by a plain text label, neither of which links anywhere. The icon is inert decoration and the label is plain text. Suited to compact inline metadata such as a clock beside a duration, a map pin beside a location, or a status glyph beside a label. Wraps Module:IconText; see the module page for rendering details. For an icon and label that both link to a page, use Template:IconLink.
| Paraméter | Leírás | Típus | Állapot | |
|---|---|---|---|---|
| Text | 1 text | Visible text label. Alias: `text` (takes precedence over the positional argument).
| Karakterlánc | kötelező |
| Icon | icon | File name (without the `File:` prefix) of the leading icon.
| Fájl | kötelező |
| Icon tooltip | iconTitle | Tooltip shown when hovering the icon; also sets the icon's alt text.
| Karakterlánc | nem kötelező |
| Icon size | size | Icon size, as a MediaWiki image size.
| Karakterlánc | nem kötelező |
| Mask icon | mask | Render the icon as a recolorable CSS mask filled with the current text color, instead of an image.
| Logikai | nem kötelező |
| CSS class | class | Extra class appended to the root span.
| Karakterlánc | nem kötelező |
Behavior
- The icon and the text sit in a single inline-flex span, so they stay on one line with a small gap and align vertically centered.
- The icon is rendered with an empty
link=andclass=metadata, so it is not clickable and is excluded from MultimediaViewer — it reads as inert decoration. iconTitle, when supplied, becomes the icon's hover tooltip (thetitleattribute) and itsalttext; without it the icon has no tooltip.maskswaps the<img>for a CSS mask filled withbackground-color: currentColor, so the icon takes on the surrounding text color and recolors with it. Provide a single-color (for example Codex) icon for the best result.textis an accepted alias for the first positional argument. If both are supplied,texttakes precedence.- If
iconor the text is omitted, the module raises a script error.
See also
- Module:IconText — implementation.
- Template:IconLink — an icon and label that link to a page.