Module:ButtonLua/doc
More actions
This is the documentation page for Module:ButtonLua
- normalizePropsL25
- getIconSrcL36
- getButtonWikitextL45
- p.renderL83
- p.mainL114
|type = website |description = Module:ButtonLua/doc is a template page used on the Star Citizen Wiki. Templates are pages that are embedded (transcluded) into other pages to allow for the repetition of information. |site_name = Star Citizen Wiki |locale = en-gb }}
Renders a Codex button as a link: a fake-button <span> wrapping a wikilink or external link, with optional icon, action, weight, and size variants.
Required by Module:CardLua, Module:Mainpage/Community, Module:Mainpage/Editing, Module:Entity/Infobox, Module:Company, and Module:Documentation; not invoked from templates.
For module editors
API
p.render(props) returns an HTML string with <templatestyles> for Module:ButtonLua/styles.css included.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
label
|
string
|
Yes | Button text; becomes the aria-label when iconOnly is set.
| |
link
|
string
|
one of link/url
|
Wiki page, rendered as [[link|…]].
| |
url
|
string
|
one of link/url
|
External URL, rendered as [url …].
| |
action
|
string
|
No | default
|
default, progressive, or destructive.
|
weight
|
string
|
No | normal
|
normal, primary, or quiet (no fill until hover).
|
size
|
string
|
No | medium
|
small, medium, or large.
|
icon
|
string
|
No | Icon file name. MediaWiki disallows <img> inside <a>, so it renders as a currentColor mask instead of an <img>.
| |
iconOnly
|
boolean
|
No | false
|
Hide the label; requires icon.
|
disabled
|
boolean
|
No | false
|
Disabled visual style. |
class
|
string
|
No | Extra CSS class(es) on the button. |
p.main(frame) is the #invoke entry point, reading arguments via Module:Arguments.
Gotchas
rendererrors only when bothlinkandurlare absent; passing both is not rejected and renders two separate links (wikilink then external link) concatenated in the same span.- Codex exposes only small and medium icon sizes: a
size = 'large'button still gets a medium icon. - The icon is a CSS mask stashed as a custom property (
--t-button-icon-url) and consumed bare instyles.css, because the sanitizer rejectsurl(var())inline but allowsimage-set()and a barevar().
Styles
A brand button opts in with class = 't-button--branded t-button--<brand>'; the brand block sets --t-button-ground (and color), and hover/active shades derive from it via color-mix. Module:ButtonLua/styles.css declares wiki-api, rsi, galactapedia/starmap (shared, same mark), verseguide, scmdb, patreon, kofi, and discord; a consumer can declare its own brand block in its own stylesheet instead of adding one here.