Difference between revisions of "Template:DropDownList"
(New Template to test) |
|||
(8 intermediate revisions by one user not shown) | |||
Line 3: | Line 3: | ||
|- | |- | ||
! colspan="2" style="border-bottom: 0.5px solid {{{border-color|#a2a9b1}}}; text-align: left; padding-left: .7em;" |<div class="mw-customtoggle-{{{id|desks}}}"> | ! colspan="2" style="border-bottom: 0.5px solid {{{border-color|#a2a9b1}}}; text-align: left; padding-left: .7em;" |<div class="mw-customtoggle-{{{id|desks}}}"> | ||
− | {{{Name|Text}}} | + | {{{Name|Text}}} {{DDA}} |
</div> | </div> | ||
<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-{{{id|desks}}}" style="padding:0px; border:0px;"> | <div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-{{{id|desks}}}" style="padding:0px; border:0px;"> | ||
<div class="mw-collapsible-content" style="text-align:left;"> | <div class="mw-collapsible-content" style="text-align:left;"> | ||
− | {{#if: {{{Value1|}}} | {{{Value1}}} }} | + | {{#if: {{{Value1|}}} | {{{Value1}}} }}{{#if: {{{Value2|}}} | <br>{{{Value2}}} }}{{#if: {{{Value3|}}} | <br>{{{Value3}}} }}{{#if: {{{Value4|}}} | <br>{{{Value4}}} }}{{#if: {{{Value5|}}} | <br>{{{Value5}}} }}{{#if: {{{Value6|}}} | <br>{{{Value6}}} }}{{#if: {{{Value7|}}} | <br>{{{Value7}}} }}{{#if: {{{Value8|}}} | <br>{{{Value8}}} }}{{#if: {{{Value9|}}} | <br>{{{Value9}}} }}{{#if: {{{Value10|}}} | <br>{{{Value10}}} }}{{#if: {{{Value11|}}} | <br>{{{Value11}}} }}{{#if: {{{Value12|}}} | <br>{{{Value12}}} }}{{#if: {{{Value13|}}} | <br>{{{Value13}}} }}{{#if: {{{Value14|}}} | <br>{{{Value14}}} }}{{#if: {{{Value15|}}} | <br>{{{Value15}}} }}{{#if: {{{Value16|}}} | <br>{{{Value16}}} }}{{#if: {{{Value17|}}} | <br>{{{Value17}}} }}{{#if: {{{Value18|}}} | <br>{{{Value18}}} }}{{#if: {{{Value19|}}} | <br>{{{Value19}}} }}{{#if: {{{Value20|}}} | <br>{{{Value20}}} }}</div></div> |
− | {{#if: {{{Value2|}}} | <br>{{{Value2}}} }} | + | |
− | {{#if: {{{Value3|}}} | <br>{{{Value3}}} }} | + | |
− | {{#if: {{{Value4|}}} | <br>{{{Value4}}} }} | + | |
− | {{#if: {{{Value5|}}} | <br>{{{Value5}}} }} | + | |
− | {{#if: {{{Value6|}}} | <br>{{{Value6}}} }} | + | |
− | {{#if: {{{Value7|}}} | <br>{{{Value7}}} }} | + | |
− | {{#if: {{{Value8|}}} | <br>{{{Value8}}} }} | + | |
− | </div></div> | + | |
|}</div></includeonly> | |}</div></includeonly> | ||
Line 25: | Line 17: | ||
===Name=== | ===Name=== | ||
− | This is the name parameter that shall display the name of the list, | + | This is the name parameter that shall display the name of the list, defaulting to 'Text'. To set the name parameter type <code><nowiki>{{DropDownList|Name=Items|Value1=One|Value2=Two|Value3=Three}}</nowiki></code> which will render as: |
{{DropDownList|Name=Items|Value1=One|Value2=Two|Value3=Three|id=Items}} | {{DropDownList|Name=Items|Value1=One|Value2=Two|Value3=Three|id=Items}} | ||
− | As another | + | As another example, links can also be used as names, as shown below:<br> |
− | <code> <nowiki>{{DropDownList|Name=[[ | + | <code> <nowiki>{{DropDownList|Name=[[:Category:Areas|Areas]]}} </nowiki> </code> renders as <br> <br>{{DropDownList|Name=[[:Category:Areas|Areas]]|id=AREAS}} |
===Values=== | ===Values=== | ||
− | The list can hold up to | + | The list can hold up to 20 values i.e. the text within the list. To add the values type <code> <nowiki>{{DropDownList|Name=Name|Value1=Hello|Value2=Wikipedia|Value3=Blah!}} </nowiki> </code> and so on until |
− | <code> <nowiki> | + | <code> <nowiki>Value20</nowiki> </code>. <br> |
Note that any blank parameters will be omitted when rendering the template. | Note that any blank parameters will be omitted when rendering the template. | ||
===Id=== | ===Id=== | ||
− | If you are using more than one DropDownList on the same page this parameter is '''very important'''. The | + | If you are using more than one DropDownList on the same page this parameter is '''very important'''. The ID parameter for each list should be different and unique (if using more than one on the same page). To set the ID type <code> <nowiki>{{DropDownList|id=Your Id name}}</nowiki> </code> |
===Colors=== | ===Colors=== | ||
Additionally, the background and border of the dropdown can also be customized. When either parameter is left blank, it will default to the template's white background and grey-ish border colors. | Additionally, the background and border of the dropdown can also be customized. When either parameter is left blank, it will default to the template's white background and grey-ish border colors. | ||
− | + | <br><br> | |
To change the background color, set a value for the parameter <code>background-color</code>. | To change the background color, set a value for the parameter <code>background-color</code>. | ||
Line 50: | Line 42: | ||
Which will render as: | Which will render as: | ||
− | {{DropDownList|background-color=# | + | {{DropDownList|background-color=#444654|Name=Items|Value1=One|Value2=Two|Value3=Three|id=Background}} |
− | + | ||
This can be set to <code>none</code> to effectively disable the background. | This can be set to <code>none</code> to effectively disable the background. | ||
Line 63: | Line 54: | ||
Similarly, you can change the border color by setting a value for the parameter <code>border-color</code>. | Similarly, you can change the border color by setting a value for the parameter <code>border-color</code>. | ||
− | <code><nowiki>{{DropDownList|border-color= | + | <code><nowiki>{{DropDownList|border-color=red|Name=Items|Value1=One|Value2=Two|Value3=Three}}</nowiki></code> |
Which will render as: | Which will render as: | ||
− | {{DropDownList|border-color=red|Name=Items|Value1=One|Value2=Two|Value3=Three|id= | + | {{DropDownList|border-color=red|Name=Items|Value1=One|Value2=Two|Value3=Three|id=RedBorder}} |
This can also be set to <code>none</code> to also disable the border. | This can also be set to <code>none</code> to also disable the border. | ||
− | <code><nowiki>{{DropDownList|border-color= | + | <code><nowiki>{{DropDownList|border-color=none|Name=Items|Value1=One|Value2=Two|Value3=Three}}</nowiki></code> |
Which will render as: | Which will render as: | ||
− | {{DropDownList|border-color=none|Name=Items|Value1=One|Value2=Two|Value3=Three|id= | + | {{DropDownList|border-color=none|Name=Items|Value1=One|Value2=Two|Value3=Three|id=BorderNone}} |
==Source== | ==Source== | ||
This template was borrowed from [https://en.wikipedia.org/wiki/Template:Drop_down_list Wikipedia]</noinclude> | This template was borrowed from [https://en.wikipedia.org/wiki/Template:Drop_down_list Wikipedia]</noinclude> |
Latest revision as of 10:29, 27 November 2023
Contents |
Usage
This template can be transcluded to display a DropDownList. This template had 3 parameters (described below). The Id parameter is very important if you are using 2 DropDownLists on the same page.
Parameters
This template contains 11 parameters for different purposes:
Name
This is the name parameter that shall display the name of the list, defaulting to 'Text'. To set the name parameter type {{DropDownList|Name=Items|Value1=One|Value2=Two|Value3=Three}}
which will render as:
As another example, links can also be used as names, as shown below:
{{DropDownList|Name=[[:Category:Areas|Areas]]}}
renders as
Values
The list can hold up to 20 values i.e. the text within the list. To add the values type {{DropDownList|Name=Name|Value1=Hello|Value2=Wikipedia|Value3=Blah!}}
and so on until
Value20
.
Note that any blank parameters will be omitted when rendering the template.
Id
If you are using more than one DropDownList on the same page this parameter is very important. The ID parameter for each list should be different and unique (if using more than one on the same page). To set the ID type {{DropDownList|id=Your Id name}}
Colors
Additionally, the background and border of the dropdown can also be customized. When either parameter is left blank, it will default to the template's white background and grey-ish border colors.
To change the background color, set a value for the parameter background-color
.
{{DropDownList|background-color=#444654|Name=Items|Value1=One|Value2=Two|Value3=Three}}
Which will render as:
This can be set to none
to effectively disable the background.
{{DropDownList|background-color=none|Name=Items|Value1=One|Value2=Two|Value3=Three}}
Which will render as:
Similarly, you can change the border color by setting a value for the parameter border-color
.
{{DropDownList|border-color=red|Name=Items|Value1=One|Value2=Two|Value3=Three}}
Which will render as:
This can also be set to none
to also disable the border.
{{DropDownList|border-color=none|Name=Items|Value1=One|Value2=Two|Value3=Three}}
Which will render as:
Source
This template was borrowed from Wikipedia