Module:Button

From Idle Clans wiki
Revision as of 12:37, 9 October 2024 by Joshical (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

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