Module:Button: Difference between revisions

From Idle Clans wiki
(Created page with "local p = {} function p.button(frame) -- Retrieve parameters passed to the template local args = frame:getParent().args -- Get parameters or set default values local label = args['label'] or "Click me" local link = args['link'] or "#" local style = args['style'] or "background-color: #1C2E44; color: white; padding: 10px 20px; text-align: center; text-decoration: none; border-radius: 4px;" -- Create the HTML button local buttonHtml = str...")
 
(Blanked the page)
Tag: Blanking
 
Line 1: Line 1:
local p = {}


function p.button(frame)
    -- Retrieve parameters passed to the template
    local args = frame:getParent().args
    -- Get parameters or set default values
    local label = args['label'] or "Click me"
    local link = args['link'] or "#"
    local style = args['style'] or "background-color: #1C2E44; color: white; padding: 10px 20px; text-align: center; text-decoration: none; border-radius: 4px;"
    -- Create the HTML button
    local buttonHtml = string.format('<a href="%s" style="%s">%s</a>', link, style, label)
    -- Return the HTML output
    return buttonHtml
end
return p

Latest revision as of 12:38, 9 October 2024

Documentation for this module may be created at Module:Button/doc