Card extension example 3
From Bootstrap for MediaWiki
| Component | ||
|---|---|---|
| Name | Card | |
| Description | Equal-height cards built in Lua from pairs of header and text | |
| Provider | BootstrapComponents | |
| Note | Needs the Scribunto extension, which runs Lua modules on the wiki. | |
| Reference | BootstrapComponents Extension docs - Lua | |
| Styling | For all possible color styles and corresponding examples, see colors. | |
Cards from header and text pairs
- Module
-- Builds a row of equal-height cards from pairs of header and text
local p = {}
function p.cards( frame )
local args = frame.args
local row = mw.html.create( 'div' ):addClass( 'row row-cols-1 row-cols-md-3 g-4 mb-3' )
local i = 1
while args[i] do
local card = mw.bootstrap.parse( 'card', mw.text.trim( args[i + 1] or '' ), { header = mw.text.trim( args[i] ), class = 'h-100' } )
row:tag( 'div' ):addClass( 'col' ):wikitext( card )
i = i + 2
end
return tostring( row )
end
return p
- Code
{{#invoke:Card grid|cards
|Chameleon|A highly customizable skin that uses Bootstrap.
|Medik|A simple and customizable skin that bundles Bootstrap.
|Tweeki|A highly customizable skin that implements as much of Bootstrap as possible.
}}
- Result
Chameleon
A highly customizable skin that uses Bootstrap.
Medik
A simple and customizable skin that bundles Bootstrap.
Tweeki
A highly customizable skin that implements as much of Bootstrap as possible.
