User:Willscrlt/UBX/Userbox

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Example with a left-side ID box (default Userbox layout)

id info


Documentation[view] [edit] [history] [purge]


Purpose[change | change source]

{{User:Willscrlt/UBX/Userbox}} — makes a userbox for users to provide information about themselves on their user page. This version has an ID box on the left and a larger Info area on the right.

This template was forked from the Userbox template on the English Wikipedia, which has different usage examples and has changed since. Additionally, this template has been enhanced to be more compatible and functional across multiple wikis. Most userboxes developed for one wiki should continue to work as-is (or with just a few tweaks) on other wikis if this template is used.

One big difference is that this template uses parser functions to combine three templates (Userbox, Userbox-r, and Userbox-2) into a single template. It does this by adding one additional attribute: layout=. The possible values are 'l' (the default) for a userbox with the smaller ID box (usually for logos) on the left (standard Userbox layout), 'r' for the reverse (Userbox-r layout), and '2' for a userbox an ID box on both ends (Userbox-2 layout). If this doesn't make sense, don't worry about it. I've created my own versions of each of these templates, so you can just use them and ignore the layout= attribute if you prefer.

This is version 2.1.0 (Userbox) of my custom template. The most current version is available from my English Wikipedia account.

Usage[change | change source]

Compact form[change | change source]

For simple userboxes, the compact form is simple, fast, and easy to understand. The numerical labels shown below ('1=', '2=', etc.) are optional unless your data includes any equal signs ('='). If you do not use labels, you must enter the values in the proper order. All attributes are optional, but you may not skip any attributes prior to the one you want to specify. It is the order of the attributes that is important when omitting labels, and skipping attributes messes up the order and breaks the template. To avoid all those limitations, simply include the numerical labels or the extended labels from the Extended form below.

This form is convenient, but considered deprecated on many Wiki projects. The standard Userbox template here may not support this form in the future, and the order of the attributes may change.

{{User:Willscrlt/UBX/Userbox
|1= id background color (defaults to '#DDD', a light gray)
|2= info background color (defaults to '#EEE', a lighter gray)
|3= id text or image (defaults to 'id')
|4= info text (defaults to 'info')
|5= id text size in points (defaults to '8', 8pts)
}}

Extended form[change | change source]

Using the extended form gives you much more control, but you must spell and capitalize the labels exactly as shown. All attributes are optional and may appear in any order. You may mix numerical and extended labels, but extended labels take precedence over numerical ones.

This form uses the labels found on many Wiki projects. The default values may be significantly different from project to project, and not all projects offer all of these attributes.

{{User:Willscrlt/UBX/Userbox
|id       = id (side box) text or image (defaults to {{3}})
|id-c     = id background color (defaults to {{1}})
|id-fc    = id font color (defaults to '#000', black)
|id-a     = 'left' (default), 'center', or 'right' alignment
|id-va    = 'middle' (default), 'top' or 'bottom' vertical alignment
|id-s     = id text size (defaults to {{5}})
|id-p     = id cell padding space (defaults to '1pt')
|id-lh    = id line height (defaults to '1.25em')
|id-w     = id box width (defaults to '45', 45px)
|id-h     = id box height (defaults to '45', 45px)
|id-op    = id other parameter (CSS) (unused by default)
|info     = info (main box) text (defaults to {{4}})
|info-c   = info background color (defaults to {{2}})
|info-fc  = info font color (defaults to '#000', black)
|info-a   = 'left' (default), 'center', or 'right' alignment
|info-va  = 'middle' (default), 'top' or 'bottom' vertical alignment
|info-s   = info text size (defaults to {{5}})
|info-p   = info cell padding space (defaults to '4pt')
|info-lh  = info line height (defaults to '1.25em')
|info-op  = info other (CSS) parameter(s) (unused by default)
|border-c = border color (defaults to {{id-c}} if set or '#999', med gray)
|border-s = border width in pixels (defaults to '1', 1px)
|float    = 'left' (default) or 'right' alignment
|layout   = 'l' (default layout), 'r' (Userbox-r layout), '2' (Userbox-2 layout)
}}

Notes[change | change source]

  • Pipes ("|") characters probably will break the template. You may be able to use the {{!}} template or a related template in place of the pipe.

Related templates[change | change source]

My versions of the templates available here at the English Wikipedia
Local versions (if any) of the templates available here at the English Wikipedia
Original versions available on the English Wikipedia which include more examples