Template:UI/button: Difference between revisions
Template page
More actions
Created page with "<noinclude> Renders a styled button-link. Supports both internal wiki page links and external URLs, with primary and secondary visual variants. Use <code>page</code> for internal links (e.g. <code>Special:RequestAccount</code>), or <code>url</code> for external links (e.g. a Brevo subscribe form). Provide exactly one. If both are set, <code>url</code> wins. The <code>style</code> parameter chooses the visual treatment: * <code>primary</code> (default) — filled progre..." |
No edit summary |
||
| Line 2: | Line 2: | ||
Renders a styled button-link. Supports both internal wiki page links and | Renders a styled button-link. Supports both internal wiki page links and | ||
external URLs, with primary and secondary visual variants. | external URLs, with primary and secondary visual variants. | ||
All styling lives in [[MediaWiki:Common.css]] under the <code>.wiki-button</code> | |||
class — change there to update every button across the wiki. This template is | |||
just structure: it picks the right link syntax (internal vs. external) and | |||
emits the right class names. | |||
Use <code>page</code> for internal links (e.g. <code>Special:RequestAccount</code>), | Use <code>page</code> for internal links (e.g. <code>Special:RequestAccount</code>), | ||
| Line 8: | Line 13: | ||
The <code>style</code> parameter chooses the visual treatment: | The <code>style</code> parameter chooses the visual treatment: | ||
* <code>primary</code> (default) — | * <code>primary</code> (default) — main call-to-action on a page | ||
* <code>secondary</code> — supporting CTA that shouldn't compete with the primary | |||
* <code>secondary</code> — | |||
Parameters: | Parameters: | ||
| Line 23: | Line 22: | ||
* <code>style</code> — <code>primary</code> or <code>secondary</code> (default: <code>primary</code>) | * <code>style</code> — <code>primary</code> or <code>secondary</code> (default: <code>primary</code>) | ||
</noinclude><includeonly>{{#if: {{{url|}}} | </noinclude><includeonly>{{#if: {{{url|}}} | ||
| [{{{url}}} <span | | [{{{url}}} <span class="{{#switch: {{{style|primary}}} | secondary = wiki-button wiki-button-secondary | #default = wiki-button }}">{{{label|}}}</span>] | ||
| [[{{{page|}}}|<span class="{{#switch: {{{style|primary}}} | secondary = wiki-button wiki-button-secondary | #default = wiki-button }}">{{{label|}}}</span>]] | |||
| [[{{{page|}}}|<span | |||
}}</includeonly> | }}</includeonly> | ||
Latest revision as of 08:22, 27 April 2026
Renders a styled button-link. Supports both internal wiki page links and external URLs, with primary and secondary visual variants.
All styling lives in MediaWiki:Common.css under the .wiki-button
class — change there to update every button across the wiki. This template is
just structure: it picks the right link syntax (internal vs. external) and
emits the right class names.
Use page for internal links (e.g. Special:RequestAccount),
or url for external links (e.g. a Brevo subscribe form). Provide
exactly one. If both are set, url wins.
The style parameter chooses the visual treatment:
primary(default) — main call-to-action on a pagesecondary— supporting CTA that shouldn't compete with the primary
Parameters:
page— internal wikilink target (mutually exclusive withurl)url— external URL (mutually exclusive withpage)label— button text (required)style—primaryorsecondary(default:primary)