Jump to content

Template:Start tab

From Wikimedia Commons, the free media repository
Template documentation[ view · edit · history · purge ]
This documentation is transcluded from Template:Start tab/doc.

Templates {{Start tab}} and {{End tab}} create a tabbed interface on project, help, portal and user pages.

Usage

{{Start tab
 |tab-1 =
 |link-1 =
 |image-1 =
 |rounding =
 |border =
 |off tab class =
 |on tab class =
 |off tab color =
 |on tab color =
 |tab spacing percent =
 |tab font-size =
 |tab alignment =
 |nowrap =
 |frame =
 |frame color =
 |no margin =
 |freeform-1 =
 |link2-1 =
 |link3-1 =
 |link4-1 =
 |link5-1 =
}}

Place {{Start tab}} at the top of the page and {{End tab}} at the end. {{End tab}} is required somewhere on the page (except in talk namespaces) to close two ‎<div> tags left open by {{Start tab}}. If {{Start tab}} uses |frame=no, {{End tab}} is not required.

Parameters ending in -1 below stand for a whole numbered series: tab-1 … tab-20, link-1 … link-20, and so on. {{Start tab}} supports up to 20 tabs; {{End tab}} (which provides the "next page" feature) supports up to 10.

Each tab needs a link-n (the title of the page it refers to) and a tab-n (its label). If the current page title matches a link-n, that tab is styled as selected. Otherwise the text in tab-n becomes a wikilink to the page given in link-n.

Freeform tabs: set freeform-n=yes to allow arbitrary wikitext in tab-n instead of plain text plus a link. When using freeform, leave link-n empty:

|freeform-1 = yes
|tab-1      = [http://www.nytimes.com/ ''The New York Times'']
|link-1     =
|image-1    =

For internal pages or subpages (sandboxes, talk page archives, etc.):

| freeform-2 = yes
| tab-2  = Sandbox ([[User:Example/Sandbox/1|1]] {{dot}} [[User:Example/Sandbox/2|2]] {{dot}} [[User:Example/Sandbox/3|3]])

Full syntax:

{{Start tab
|tab-1               = <!-- up to |tab-20= -->
|link-1              = <!-- up to |link-20= -->
|image-1             = <!-- up to |image-20= -->
|rounding            =
|border              =
|off tab class       =
|on tab class        =
|off tab color       =
|on tab color        =
|tab spacing percent =
|tab font-size       =
|tab alignment       =
|nowrap              =
|frame               =
|frame color         =
|no margin           =
}}

<!-- Text for main part of page goes here. -->

{{End tab
|tab-1         =
|link-1        =
|tab-2         =
|link-2        =
|tab-3         = <!-- up to |tab-10= -->
|link-3        = <!-- up to |link-10= -->
|off tab color =
|border        =
|rounding      =
}}

Template parameters

ParameterDescriptionDefaultStatus
tab-1Tab labelThe name of the tab. Repeat as tab-2 … tab-20 (up to tab-10 in {{End tab}}).emptyrequired
link-1Tab linkThe tab link location (page title). Repeat as link-2 … link-20. Leave empty when freeform-n=yes.emptyrequired
image-1Tab imageName of an optional image (shown at 20px) placed next to the tab title. Repeat as image-2 … image-20. {{Start tab}} only.emptyoptional
roundingRoundingAdds a rounding effect to the edges of the tab boxes (CSS length, e.g. 5em).emptyoptional
borderBorderBorder style (CSS, e.g. 1px solid #808080).emptyoptional
off tab classOff tab classCSS class of the currently unselected tabs. {{Start tab}} only.emptyoptional
on tab classOn tab classCSS class of the currently selected tab. {{Start tab}} only.emptyoptional
off tab colorOff tab colorColor of the currently unselected tabs.emptyoptional
on tab colorOn tab colorColor of the currently selected tab. {{Start tab}} only.emptyoptional
tab spacing percentTab spacing percentOverrides the width between the tabs. {{Start tab}} only.emptyoptional
tab font-sizeTab font sizeOverrides the font size of the text in the tabs. {{Start tab}} only.emptyoptional
tab alignmentTab alignmentOverrides the alignment of the tab titles. {{Start tab}} only.emptyoptional
nowrapNo wrapPrevents long names from wrapping on each tab. {{Start tab}} only.emptyoptional
frameFrameSet to yes to add a page frame underneath the tabs. Does nothing in talk namespaces. Close it by adding </div></div> or {{End tab}} at the end of the page (or wherever the frame should close). Generally not recommended, as it breaks VisualEditor and the reply tool.emptyoptional
frame colorFrame colorBackground color for the frame. {{Start tab}} only.value of on tab coloroptional
no marginNo marginSet to yes to disable the margin between the tabs. {{Start tab}} only.emptyoptional
freeform-1Freeform tabSet to yes to allow arbitrary wikitext in tab-1 rather than plain text and a link; link-1 then stays empty. Repeat as freeform-2 … freeform-20.emptyoptional
link2-1Second linkThe tab's 2nd link location. Only applies when using freeform-n. Repeat as link2-2 … link2-20.emptyoptional
link3-1Third linkThe tab's 3rd link location. Only applies when using freeform-n. Repeat as link3-2 … link3-20.emptyoptional
link4-1Fourth linkThe tab's 4th link location. Only applies when using freeform-n. Repeat as link4-2 … link4-20.emptyoptional
link5-1Fifth linkThe tab's 5th link location. Only applies when using freeform-n. Repeat as link5-2 … link5-20.emptyoptional
preumsPreumsInternal use only by {{Page tabs}}. Do not set manually.emptydeprecated
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateData • Commons-specific information

Templates [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] and [[:Template:End tab|<span style="font-family:monospace,monospace;">&#123;&#123;End tab&#125;&#125;</span>]] create a tabbed interface on project, help, portal and user pages.

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Borderborder

Border style (CSS, e.g. <code>1px solid #808080</code>).

Lineoptional
Frameframe

Set to <code>yes</code> to add a page frame underneath the tabs. Does nothing in talk namespaces. Close it by adding <code>&lt;/div&gt;&lt;/div&gt;</code> or [[:Template:End tab|<span style="font-family:monospace,monospace;">&#123;&#123;End tab&#125;&#125;</span>]] at the end of the page (or wherever the frame should close). Generally not recommended, as it breaks VisualEditor and the reply tool.

Suggested values
yes no
Lineoptional
Frame colorframe color

Background color for the frame. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Default
value of <code>on tab color</code>
Lineoptional
Freeform tabfreeform-1

Set to <code>yes</code> to allow arbitrary wikitext in <code>tab-1</code> rather than plain text and a link; <code>link-1</code> then stays empty. Repeat as <code>freeform-2</code> … <code>freeform-20</code>.

Suggested values
yes
Lineoptional
Tab imageimage-1

Name of an optional image (shown at 20px) placed next to the tab title. Repeat as <code>image-2</code> … <code>image-20</code>. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Fileoptional
Tab linklink-1

The tab link location (page title). Repeat as <code>link-2</code> … <code>link-20</code>. Leave empty when <code>freeform-n=yes</code>.

Page namerequired
Second linklink2-1

The tab's 2nd link location. Only applies when using <code>freeform-n</code>. Repeat as <code>link2-2</code> … <code>link2-20</code>.

Page nameoptional
Third linklink3-1

The tab's 3rd link location. Only applies when using <code>freeform-n</code>. Repeat as <code>link3-2</code> … <code>link3-20</code>.

Page nameoptional
Fourth linklink4-1

The tab's 4th link location. Only applies when using <code>freeform-n</code>. Repeat as <code>link4-2</code> … <code>link4-20</code>.

Page nameoptional
Fifth linklink5-1

The tab's 5th link location. Only applies when using <code>freeform-n</code>. Repeat as <code>link5-2</code> … <code>link5-20</code>.

Page nameoptional
No marginno margin

Set to <code>yes</code> to disable the margin between the tabs. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Suggested values
yes
Lineoptional
No wrapnowrap

Prevents long names from wrapping on each tab. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Booleanoptional
Off tab classoff tab class

CSS class of the currently unselected tabs. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Lineoptional
Off tab coloroff tab color

Color of the currently unselected tabs.

Lineoptional
On tab classon tab class

CSS class of the currently selected tab. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Lineoptional
On tab coloron tab color

Color of the currently selected tab. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Lineoptional
Preumspreums

'''Internal use only''' by [[:Template:Page tabs|<span style="font-family:monospace,monospace;">&#123;&#123;Page tabs&#125;&#125;</span>]]. Do not set manually.

Unknowndeprecated
Roundingrounding

Adds a rounding effect to the edges of the tab boxes (CSS length, e.g. <code>5em</code>).

Lineoptional
Tab alignmenttab alignment

Overrides the alignment of the tab titles. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Suggested values
left center right
Lineoptional
Tab font sizetab font-size

Overrides the font size of the text in the tabs. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Lineoptional
Tab spacing percenttab spacing percent

Overrides the width between the tabs. [[:Template:Start tab|<span style="font-family:monospace,monospace;">&#123;&#123;Start tab&#125;&#125;</span>]] only.

Numberoptional
Tab labeltab-1

The name of the tab. Repeat as <code>tab-2</code> … <code>tab-20</code> (up to <code>tab-10</code> in [[:Template:End tab|<span style="font-family:monospace,monospace;">&#123;&#123;End tab&#125;&#125;</span>]]).

Stringrequired

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: all users

Placement: At the top of the page

See also

Localization

This template is not intended to be localized.

Examples

Basic, with frame

{{Start tab
| frame   = yes
| tab-1   = Current page
| link-1  = Template:Start tab
| image-1 = Curly Brackets.svg
| tab-2   = Project
| link-2  = Wikipedia:WikiProject Athletics
| tab-3   = Project talk
| link-3  = Wikipedia talk:WikiProject Athletics
| tab-4   = Olympics Project
| link-4  = Wikipedia:WikiProject Olympics
| image-4 = Olympic Rings.svg
}}

Text for main part of page goes here.

{{End tab
| frame  = yes
| tab-1  = Current page
| link-1 = Template:Start tab
| tab-2  = Project
| link-2 = Wikipedia:WikiProject Athletics
| tab-3  = Project talk
| link-3 = Wikipedia talk:WikiProject Athletics
| tab-4  = Olympics Project
| link-4 = Wikipedia:WikiProject Olympics
}}
 Current page Current page Project Project talk Olympics Project Olympics Project 

Text for main part of page goes here.

Next page: Project→

With rounding

{{Start tab
| tab-1         = Current page
| link-1        = Template:Start tab
| image-1       = Curly Brackets.svg
| tab-2         = Project
| link-2        = Wikipedia:WikiProject Athletics
| tab-3         = Project talk
| link-3        = Wikipedia talk:WikiProject Athletics
| tab-4         = Olympics Project
| link-4        = Wikipedia:WikiProject Olympics
| image-4       = Olympic Rings.svg
| rounding      = 5em
| border        = 1px solid #808080
| off tab color = #f0f0ff
| tab alignment = center
| frame         = yes
}}

Text for main part of page goes here.

{{End tab
| tab-1         = Current page
| link-1        = Template:Start tab
| tab-2         = Project
| link-2        = Wikipedia:WikiProject Athletics
| tab-3         = Project talk
| link-3        = Wikipedia talk:WikiProject Athletics
| tab-4         = Olympics Project
| link-4        = Wikipedia:WikiProject Olympics
| rounding      = 5em
| border        = 1px solid #808080
| off tab color = #f0f0ff
| frame         = yes
}}
 Current page Current page Project Project talk Olympics Project Olympics Project 

Text for main part of page goes here.

Next page: Project→