قالب:Clickable button/doc
| هذه صفحة توثيق فرعية لـ قالب:Clickable button. تتضمن معلومات الاستعمال، التصنيفات وأي محتوى آخر ليس من محتويات الأصل لصفحة القالب. |
| This template is used in system messages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid large-scale disruption, any changes should first be tested in this template's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this template. Please discuss any changes at the talk page before implementing them. |
| Uses Lua: |
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
{{Clickable button|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
|color=or|class=- Color to display.
|color=acceptsblueandred,|class=acceptsmw-ui-progressiveandmw-ui-destructive |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
|link=no- Use this parameter set to "no" to display a button without linking to anything
Examples
Wikilinks
{{Clickable button|Main Page}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|Main Page|Click here to visit the main page}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|Click here|link=no}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".
Colors
{{Clickable button|Main Page}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button". – without defined|color=and|class=, the default is a white button{{Clickable button|Main Page|color=blue}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|Main Page|color=red}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|Main Page|class=mw-ui-progressive}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|Main Page|class=mw-ui-destructive}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".
URLs
{{Clickable button|url=https://example.com}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|Example|url=https://example.com}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".{{Clickable button|2=Example|url=https://example.com}}→ خطأ: لا توجد وحدة بهذا الاسم "Clickable button".
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 aria-hidden="true" so that a screen reader doesn't read it out loud.
<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>
Template data
Styles a link like a button, using the mediawiki.ui.button module
| وسيط | وصف | نوع | حالة | |
|---|---|---|---|---|
| Link/Label | 1 | Defines the page to link to, and uses that page's title as the text for the button
| اسم الصفحة | مطلوب |
| Label | 2 | Defines the text that appears on the button
| غير معروف | مقترح |
| URL | url | Defines a web address for the button to link to
| مسار | اختياري |
| class | class | Defines the visual type of the button
| نص | اختياري |
| Custom CSS styling | style | Allows custom CSS styling to be applied to the button
| نص | اختياري |
| Category switch | category | Whether or not categories should be on
| بولياني | اختياري |
| color | color | Defines the visual type of the button
| نص | اختياري |
See also
- commons:Template:Clickable button, corresponding clickable button at Commons.
- phab:T146923, which dropped support for
mw-ui-constructive, the CSS class for green buttons