« Modèle:Button » : différence entre les versions

De 21Wiki
Aucun résumé des modifications
Balise : Éditeur de wikicode 2017
Aucun résumé des modifications
Balise : Éditeur de wikicode 2017
Ligne 1 : Ligne 1 :
<span class="mw-ui-button {{#switch: {{{color|white}}} | red = mw-ui-destructive | green = mw-ui-progressive | white = | blue = mw-ui-progressive}}" role="button" aria-disabled="false">{{{text|{{{1|Button text}}}}}}</span>
*'''Code: '''<code><nowiki>{{Clickable button 2|Main Page}}</nowiki></code>
 
**'''Result: '''{{Clickable button 2|Main Page}}
== Example ==
*'''Code: '''<code><nowiki>{{Clickable button 2|Main Page|Cover page}}</nowiki></code>
{{Clickable button|color=white}} <nowiki>{{Clickable button|color=white}}</nowiki>
**'''Result: '''{{Clickable button 2|Main Page|Cover page}}
 
*'''Code: '''<code><nowiki>{{Clickable button 2|Main Page|url=http://en.wikipedia.org}}</nowiki></code>
{{Clickable button|color=red}} <nowiki>{{Clickable button|color=red}}</nowiki>
**'''Result: '''{{Clickable button 2|Main Page|url=http://en.wikipedia.org}}
 
*'''Code: '''<code><nowiki>{{Clickable button 2|Main Page|class=mw-ui-destructive}}</nowiki></code>
{{Clickable button|color=blue}} <nowiki>{{Clickable button|color=blue}}</nowiki>
**'''Result: '''{{Clickable button 2|Main Page|class=mw-ui-destructive}}
 
*'''Code: '''<code><nowiki>{{Clickable button 2|Main Page|class=mw-ui-progressive}}</nowiki></code>
[[target|{{Clickable button|text}}]] → <nowiki>[[target|{{Clickable button|text}}]]</nowiki> (for links. To add links, transclude this template inside wikilinks after the pipebar: <nowiki>[[target title|{{Clickable button|text}}]]</nowiki>. Or better use {{tl|clickable button 2}} which adds links automatically)
**'''Result: '''{{Clickable button 2|Main Page|class=mw-ui-progressive}}
== Templatedata ==
<templatedata>
{
"params": {
"color": {
"label": "Color of the button",
"description": "Can be blue (progressive), red (destructive) or white",
"suggested": true,
"type": "string"
},
"text": {
"aliases": [
"1"
],
"label": "Label",
"type": "content",
"required": true
}
},
"description": "Creates a OOUI styled button.",
"paramOrder": [
"text",
"color"
],
"format": "inline"
}
</templatedata>

Version du 9 juin 2024 à 10:35