Module:Card grid
From Bootstrap for MediaWiki
Builds a row of cards of equal height from headers and texts. On narrow screens, the cards stack.
Usage
{{#invoke:Card grid|cards
|First header|First text
|Second header|Second text
|Third header|Third text
}}
Parameters
- Headers and texts in pairs: each header is followed by the text of its card. Up to three cards fit side by side; more cards continue on the next row.
Requirements
Example
-- 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
