<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.shroudforge.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AButtonLua</id>
	<title>Module:ButtonLua - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.shroudforge.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AButtonLua"/>
	<link rel="alternate" type="text/html" href="https://wiki.shroudforge.net/index.php?title=Module:ButtonLua&amp;action=history"/>
	<updated>2026-11-05T03:04:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.shroudforge.net/index.php?title=Module:ButtonLua&amp;diff=38&amp;oldid=prev</id>
		<title>Bonsaibauer: 1 revision imported: Import of Star-Citizen-Modules</title>
		<link rel="alternate" type="text/html" href="https://wiki.shroudforge.net/index.php?title=Module:ButtonLua&amp;diff=38&amp;oldid=prev"/>
		<updated>2026-11-04T21:58:41Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported: Import of Star-Citizen-Modules&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:58, 4 November 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key mediawiki-mediawiki:diff:1.41:old-37:rev-38 --&gt;
&lt;/table&gt;</summary>
		<author><name>Bonsaibauer</name></author>
	</entry>
	<entry>
		<id>https://wiki.shroudforge.net/index.php?title=Module:ButtonLua&amp;diff=37&amp;oldid=prev</id>
		<title>starcitizen&gt;Alistair3149: Sync from Git (f7988cd) (via create-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://wiki.shroudforge.net/index.php?title=Module:ButtonLua&amp;diff=37&amp;oldid=prev"/>
		<updated>2026-05-27T00:16:12Z</updated>

		<summary type="html">&lt;p&gt;Sync from Git (f7988cd) (via create-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;#039;strict&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
--- Lua interface for building a button.&lt;br /&gt;
--- This module uses Codex Button directly because the styles are already loaded in Citizen.&lt;br /&gt;
&lt;br /&gt;
--- @class ButtonProps&lt;br /&gt;
--- @field label string&lt;br /&gt;
--- @field link string&lt;br /&gt;
--- @field url string&lt;br /&gt;
--- @field action ButtonAction&lt;br /&gt;
--- @field weight ButtonWeight&lt;br /&gt;
--- @field size ButtonSize&lt;br /&gt;
--- @field disabled boolean @default false&lt;br /&gt;
--- @field icon string&lt;br /&gt;
--- @field iconOnly boolean @default false&lt;br /&gt;
--- @field class string @default nil&lt;br /&gt;
&lt;br /&gt;
--- @alias ButtonAction &amp;#039;default&amp;#039; | &amp;#039;progressive&amp;#039; | &amp;#039;destructive&amp;#039; @default &amp;#039;default&amp;#039;&lt;br /&gt;
--- @alias ButtonWeight &amp;#039;normal&amp;#039; | &amp;#039;primary&amp;#039; @default &amp;#039;normal&amp;#039;&lt;br /&gt;
--- @alias ButtonSize &amp;#039;small&amp;#039; | &amp;#039;medium&amp;#039; | &amp;#039;large&amp;#039; @default &amp;#039;medium&amp;#039;&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--- @param props ButtonProps&lt;br /&gt;
local function normalizeProps(props)&lt;br /&gt;
	props.action = props.action or &amp;#039;default&amp;#039;&lt;br /&gt;
	props.weight = props.weight or &amp;#039;normal&amp;#039;&lt;br /&gt;
	props.size = props.size or &amp;#039;medium&amp;#039;&lt;br /&gt;
	props.iconOnly = props.iconOnly or false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Get the icon src for the button&lt;br /&gt;
---&lt;br /&gt;
--- @param icon string&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getIconSrc(icon)&lt;br /&gt;
	return mw.getCurrentFrame():callParserFunction(&amp;#039;filepath&amp;#039;, {&lt;br /&gt;
		icon,&lt;br /&gt;
		&amp;#039;nowiki&amp;#039;,&lt;br /&gt;
	})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- @param props ButtonProps&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getButtonWikitext(props)&lt;br /&gt;
	local html = mw.html.create(&amp;#039;span&amp;#039;)&lt;br /&gt;
	local isIconOnly = props.iconOnly and props.icon&lt;br /&gt;
&lt;br /&gt;
	html:addClass(&amp;#039;t-button&amp;#039;)&lt;br /&gt;
		:addClass(&amp;#039;cdx-button&amp;#039;)&lt;br /&gt;
		:addClass(&amp;#039;cdx-button--fake-button&amp;#039;)&lt;br /&gt;
		:addClass(&amp;#039;cdx-button--fake-button&amp;#039; .. (props.disabled and &amp;#039;--disabled&amp;#039; or &amp;#039;--enabled&amp;#039;))&lt;br /&gt;
		:addClass(&amp;#039;cdx-button--action-&amp;#039; .. props.action)&lt;br /&gt;
		:addClass(&amp;#039;cdx-button--weight-&amp;#039; .. props.weight)&lt;br /&gt;
		:addClass(&amp;#039;cdx-button--size-&amp;#039; .. props.size)&lt;br /&gt;
		:addClass(props.class)&lt;br /&gt;
&lt;br /&gt;
	-- HACK: Since MW does not allow &amp;lt;img&amp;gt; within &amp;lt;a&amp;gt; tags,&lt;br /&gt;
	-- we inject the icon as a background image instead.&lt;br /&gt;
	if props.icon then&lt;br /&gt;
		-- CdxButton only supports small and medium icons, so we need to map the size&lt;br /&gt;
		local iconSize = props.size == &amp;#039;small&amp;#039; and &amp;#039;small&amp;#039; or &amp;#039;medium&amp;#039;&lt;br /&gt;
&lt;br /&gt;
		html:tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;cdx-icon&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;cdx-icon--&amp;#039; .. iconSize)&lt;br /&gt;
			:cssText(&amp;#039;--t-button-icon-url: &amp;quot;&amp;#039; .. getIconSrc(props.icon) .. &amp;#039;&amp;quot;;&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not isIconOnly then&lt;br /&gt;
		html:wikitext(props.label)&lt;br /&gt;
	else&lt;br /&gt;
		html:attr(&amp;#039;aria-label&amp;#039;, props.label)&lt;br /&gt;
		html:addClass(&amp;#039;cdx-button--icon-only&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(html)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- @param props ButtonProps&lt;br /&gt;
--- @return string&lt;br /&gt;
function p.render(props)&lt;br /&gt;
	normalizeProps(props)&lt;br /&gt;
&lt;br /&gt;
	if not props.link and not props.url then&lt;br /&gt;
		error(&amp;#039;No link or URL provided&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local root = mw.html.create(&amp;#039;span&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	root:addClass(&amp;#039;t-button&amp;#039;):addClass(&amp;#039;plainlinks&amp;#039;) -- Remove external link icon&lt;br /&gt;
&lt;br /&gt;
	local buttonWikitext = getButtonWikitext(props)&lt;br /&gt;
&lt;br /&gt;
	if props.link then&lt;br /&gt;
		root:wikitext(string.format(&amp;#039;[[%s|%s]]&amp;#039;, props.link, buttonWikitext))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if props.url then&lt;br /&gt;
		root:wikitext(string.format(&amp;#039;[%s %s]&amp;#039;, props.url, buttonWikitext))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return mw.getCurrentFrame():extensionTag({&lt;br /&gt;
		name = &amp;#039;templatestyles&amp;#039;,&lt;br /&gt;
		args = { src = &amp;#039;Module:ButtonLua/styles.css&amp;#039; },&lt;br /&gt;
	}) .. tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Wikitext entry point for the module&lt;br /&gt;
---&lt;br /&gt;
--- @param frame mw.frame&lt;br /&gt;
--- @return string&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
	return p.render(getArgs(frame))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>starcitizen&gt;Alistair3149</name></author>
	</entry>
</feed>