Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Help
Introduction to techRepo
Quick links
Main site
GitHub
SNS
Instagram
LinkedIn
X (Twitter)
YouTube
Search
Search
English
Appearance
Create account
Log in
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Editing
Template
:
Clickable button/doc
Template
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
Information about this page.
Get shortened URL
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} {{Template shortcut|CLB|Click}} {{Always substitute|yesnomaybe=never}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{clear}}{{Lua|Module:Clickable button}} {{Warning|[[MOS:BUTTONS|Buttons]] should '''not''' be used in the '''article namespace'''. If the desire is to "navigate" a reader to a new page, taking them away from the current page, a [[Wikipedia:Manual of Style/Linking|link]] is preferred. Buttons are used within Wikipedia to trigger an "action".}} {{Used in system}} This template styles a link like a button, using the deprecated mediawiki.ui.button module. This expands the clickable area and tap target for the link. ==Usage== ;All parameters :{{tlc|{{BASEPAGENAME}}|''wikilink''|''display''|color{{=}}''color''|url{{=}}''url''|class{{=}}''class''|link{{=}}}} ;''wikilink'' :Unnamed first parameter; the title of the page being linked. Brackets are not necessary ;''display'' (optional) :Optional unnamed second parameter; the text to display. Not needed if the text to display is the wikilink itself ;{{para|color}} or {{para|class}} :Color to display. {{para|color}} accepts <code>blue</code> and <code>red</code>, {{para|class}} accepts <code>mw-ui-progressive</code> and <code>mw-ui-destructive</code> ;{{para|url}} :URL to link through the button. If no wikilink/display text is provided, will show the URL, otherwise will show the wikilink/display text ;{{para|link|no}} :Use this parameter set to "no" to display a button without linking to anything == Examples == ===Wikilinks=== :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page|Click here to visit the main page}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Click here|link=no}}</nowiki>}} ===Colors=== :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page}}</nowiki>}} β without defined {{para|color}} and {{para|class}}, the default is a white button :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page|color=blue}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page|color=red}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page|class=mw-ui-progressive}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Main Page|class=mw-ui-destructive}}</nowiki>}} ===URLs=== :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|url=https://example.com}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|Example|url=https://example.com}}</nowiki>}} :{{Demo inline|<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2=Example|url=https://example.com}}</nowiki>}} ===Adding an icon=== Adding an icon to a button should be avoided. Don't forget to hide the icon from the accessibility DOM by wrapping it in a span that is {{attr|aria-hidden|"true"}} so that a screen reader doesn't read it out loud. <syntaxhighlight lang="wikitext"> <span class="mw-ui-button mw-ui-progressive"><span aria-hidden="true">[[File:OOjs UI icon logo-wikimediaCommons-invert.svg|15px|link=|alt=]]</span> More details</span> </syntaxhighlight> <span class="mw-ui-button mw-ui-progressive">[[File:OOjs UI icon logo-wikimediaCommons-invert.svg|15px|link=|alt=]] More details</span> == Template data == <templatedata> { "params": { "1": { "required": true, "label": "Link/Label", "description": "Defines the page to link to, and uses that page's title as the text for the button", "example": "Foobar", "type": "wiki-page-name" }, "2": { "suggested": true, "label": "Label", "description": "Defines the text that appears on the button", "default": "the page being linked to" }, "url": { "type": "url", "label": "URL", "description": "Defines a web address for the button to link to", "example": "https://www.example.com" }, "class": { "type": "string", "description": "Defines the visual type of the button", "suggestedvalues": [ "mw-ui-progressive", "mw-ui-destructive" ] }, "style": { "type": "string", "label": "Custom CSS styling", "description": "Allows custom CSS styling to be applied to the button", "example": "border: 2px solid red;", "default": "None" }, "category": { "type": "boolean", "label": "Category switch", "description": "Whether or not categories should be on", "example": "no", "default": "yes", "autovalue": "0" }, "color": { "suggestedvalues": [ "blue", "red" ], "description": "Defines the visual type of the button", "type": "string" } }, "description": "Styles a link like a button, using the mediawiki.ui.button module", "format": "inline" } </templatedata> == See also == * [[commons:Template:Clickable button]], corresponding clickable button at Commons. * [[phab:T146923]], which dropped support for <code>mw-ui-constructive</code>, the CSS class for green buttons {{Button templates}} <includeonly>{{Sandbox other|| <!-- Categories and interwikis go here: --> [[Category:Wikipedia button templates]] [[Category:MediaWiki interface templates]] }}</includeonly>
Summary:
Please note that all contributions to ARC Technical Repository may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TechRepo:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Pages included on this page:
Template:Always substitute
(
edit
)
Template:Attr
(
edit
)
Template:Button templates
(
edit
)
Template:Clear
(
edit
)
Template:Clickable button
(
edit
)
Template:Demo inline
(
edit
)
Template:Documentation subpage
(
edit
)
Template:Editnotice EXPECTUNUSEDTEMPLATE
(
edit
)
Template:FULLROOTPAGENAME
(
edit
)
Template:Hlist/styles.css
(
edit
)
Template:Icon
(
edit
)
Template:Lua
(
edit
)
Template:Mbox
(
edit
)
Template:Navbox
(
edit
)
Template:Ns has subpages
(
edit
)
Template:Ombox
(
edit
)
Template:Para
(
edit
)
Template:Parameter
(
edit
)
Template:Plainlist/styles.css
(
edit
)
Template:Strong
(
edit
)
Template:Template link
(
edit
)
Template:Template link code
(
edit
)
Template:Template other
(
edit
)
Template:Template shortcut
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Tl
(
edit
)
Template:Tlc
(
edit
)
Template:Unbulleted list
(
edit
)
Template:Used in system
(
edit
)
Template:Warning
(
edit
)
Template:Yesno
(
edit
)
Template:Yesno-no
(
edit
)
Module:Arguments
(
edit
)
Module:Clickable button
(
edit
)
Module:Delink
(
edit
)
Module:Demo
(
edit
)
Module:Effective protection level
(
edit
)
Module:High-use
(
edit
)
Module:Icon
(
edit
)
Module:Icon/data
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Navbar
(
edit
)
Module:Navbar/configuration
(
edit
)
Module:Navbar/styles.css
(
edit
)
Module:Navbox
(
edit
)
Module:Navbox/configuration
(
edit
)
Module:Navbox/styles.css
(
edit
)
Module:Ns has subpages
(
edit
)
Module:TableTools
(
edit
)
Module:Template link general
(
edit
)
Module:Text
(
edit
)
Module:Text/data
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/C
(
edit
)
Module:Unsubst
(
edit
)
Module:Yesno
(
edit
)
Search
Search
Editing
Template
:
Clickable button/doc
Add languages
Add topic