Template:Pill: Difference between revisions

From Alpine Linux
(template pill, add)
 
(added support for both positional and named parameters)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{Template}}
<noinclude>{{Template}}


'''A generic message Pill.'''
'''Base pill styling template used by pill variants.'''


====Usage====
====Usage====
Can be used standalone or as a base for other templates like [[:Template:Pill_clickable]]. This template supports both positional and named parameters. If positional parameters are used, empty positions must be properly accounted as in
example 10.
{{Codeline|1=<nowiki>{{Pill|text=v3.22.x}}</nowiki>}}
{{Codeline|1=<nowiki>{{Pill|prefix=Alpine |text=v3.22.x|border=blue|bg=lightblue|float=left}}</nowiki>}}
{{Codeline|1=<nowiki>{{Pill||<-v3.14.x|#DF0000|#FFDFDF}}</nowiki>}}
{{Codeline|1=<nowiki>{{Pill||<-v3.14.x|#DF0000|#FFDFDF}}</nowiki>}}


Line 17: Line 25:


{{Codeline|1=<nowiki>{{Pill||WIP|goldenrod|yellow}}</nowiki>}}
{{Codeline|1=<nowiki>{{Pill||WIP|goldenrod|yellow}}</nowiki>}}
{{Codeline|1=<nowiki>{{Pill||v3.20.x|||left}}</nowiki>}}
====Parameters====
{| class="wikitable"
|+ Parameter reference (supports both positional and named parameters)
|-
! Position !! Field Name !! Description !! Mandatory
|-
| 1 || prefix || Prefix text  || optional
|-
| 2 || text || Main text || required
|-
| 3 || border || Border color || optional (default: green)
|-
| 4 || bg || Background color || optional (default: palegreen)
|-
| 5 || float || Float position  || optional (default: right; use "none" for inline)
|}


====Example====
====Example====


{{Pill||<- v3.14.x|#DF0000|#FFDFDF}}
{{Pill|text=v3.22.x}}
 
{{Pill|prefix=Alpine |text=v3.22.x|border=blue|bg=lightblue|float=left}}
{{Pill||<-v3.14.x|#DF0000|#FFDFDF}}
{{Pill||v3.15.x-v3.18.x|#aaa|#eee}}
{{Pill||v3.15.x-v3.18.x|#aaa|#eee}}
{{Pill||v3.19.x-v3.20.x|orange|goldenrod}}
{{Pill||v3.19.x-v3.20.x|orange|goldenrod}}
{{Pill||v3.21.x|cadetblue|lightblue}}
{{Pill||v3.21.x|cadetblue|lightblue}}
{{Pill||v3.22.x|green|palegreen}}
{{Pill||v3.22.x|green|palegreen}}
{{Pill|Version:|current|purple|cornflowerblue|left}}
{{Pill|Version:|current|purple|cornflowerblue|left}}
{{Pill||WIP|goldenrod|yellow}}
{{Pill||WIP|goldenrod|yellow}}
 
{{Pill||v3.20.x|||left}}
</noinclude><includeonly><p style="padding: 2px; margin: 2px 2px; background-color: {{{4}}}; border: 2px solid {{{3|#000000}}}; -moz-border-radius: 1em; border-radius: 1em; float: {{{5|right}}}; font-size:80%; "><strong> {{{1}}} </strong>{{{2}}}</p></includeonly>
</noinclude>
<includeonly><span style="padding:2px;background-color:{{#if:{{{bg|{{{4|}}}}}}|{{{bg|{{{4}}}}}}|palegreen}};border:2px solid {{#if:{{{border|{{{3|}}}}}}|{{{border|{{{3}}}}}}|green}};border-radius:1em;display:inline-block;font-size:80%;float:{{#if:{{{float|{{{5|}}}}}}|{{{float|{{{5}}}}}}|right}};margin-left:20px;"><strong>{{{prefix|{{{1|}}}}}}</strong>{{{text|{{{2}}}}}}</span></includeonly>

Latest revision as of 16:04, 7 December 2025

Template Documentation for Pill

This page is a template and should only be used as part of other articles. For more information, read Help:Template.

Please do not experiment with this template; you could ruin all pages using this template. If you want to edit this template, copy the text to Template:Sandbox, edit and test it there, and copy it back when it works.

Feel free to voice your opinion regarding this template.

Base pill styling template used by pill variants.

Usage

Can be used standalone or as a base for other templates like Template:Pill_clickable. This template supports both positional and named parameters. If positional parameters are used, empty positions must be properly accounted as in example 10.

{{Pill|text=v3.22.x}}

{{Pill|prefix=Alpine |text=v3.22.x|border=blue|bg=lightblue|float=left}}

{{Pill||<-v3.14.x|#DF0000|#FFDFDF}}

{{Pill||v3.15.x-v3.18.x|#aaa|#eee}}

{{Pill||v3.19.x-v3.20.x|orange|goldenrod}}

{{Pill||v3.21.x|cadetblue|lightblue}}

{{Pill||v3.22.x|green|palegreen}}

{{Pill|Version:|current|purple|cornflowerblue|left}}

{{Pill||WIP|goldenrod|yellow}}

{{Pill||v3.20.x|||left}}

Parameters

Parameter reference (supports both positional and named parameters)
Position Field Name Description Mandatory
1 prefix Prefix text optional
2 text Main text required
3 border Border color optional (default: green)
4 bg Background color optional (default: palegreen)
5 float Float position optional (default: right; use "none" for inline)

Example

v3.22.x

Alpinev3.22.x

<-v3.14.x

v3.15.x-v3.18.x

v3.19.x-v3.20.x

v3.21.x

v3.22.x

Version:current

WIP

v3.20.x