Quick start guide and documentation
<head>)
</body>)
Card Title
Your content here...
data-same-size="true".
Perfect for feature lists, service offerings, or pricing tiers
Feature Name
Description of the feature...
Great for team members, products, or portfolio items
Card Title
Content that will be truncated after 2 lines...
Creates visual interest with the image appearing to "lift" into the header area
Card Title
Content below the image...
Display full-width images at the bottom with cover styling
Card Title
Main content...
Make cards keyboard-focusable and clickable for navigation
Product Name
Short description...
| Attribute | Purpose | Applied To |
|---|---|---|
data-same-size="true" |
Equalizes card and header heights per row | .card |
data-tab-card="true" |
Makes card keyboard-focusable like a button | .card |
data-truncate-lines="N" |
Limits text to N lines with ellipsis | .card-body |
role="button" |
Screen reader support for interactive cards | .card (with data-tab-card) |
tabindex="0" |
Adds card to keyboard tab order | .card (with data-tab-card) |
| Class | Purpose |
|---|---|
.card |
Main card container |
.card-header |
Card header section |
.card-title |
Card title/heading |
.card-body |
Main content area |
.card-footer |
Footer section |
.img-wrapper |
Container for images |
.card-img |
Image element styling |
.push-img-top |
Creates push-up image effect |
.img-cover |
Full-width cover-style images |
data-same-size="true" on all cards in a row for consistent, professional-looking layouts
data-truncate-lines with equal-height cards to maintain visual consistency
data-tab-card="true" for product grids or navigation cards to improve keyboard accessibility
alt attributes on images for accessibility
.rsl-bg-info for colored card variants
data-same-size="true" is on each .card elementcards.js is loaded after layout.js.slot-layout rowdata-truncate-lines="N" is on .card-body<p> or similar block elementdata-tab-card="true", role="button", and tabindex="0" are all presentRSL Cards include built-in accessibility:
data-tab-card="true"Open cards.html in your browser
Use playground.html as a template
Combine different card patterns for unique layouts
The Cards component is fully compatible with RSL's JSON Layout API,
enabling declarative card layouts with automatic height equalization through JavaScript configuration.
Cards automatically initialize after rendering via RSL.JSONLayout.renderLayout().
.card[data-same-size="true"] elements using the JSON API,
the card height equalizer automatically initializes without manual setup.
// Create card grid with JSON API
const config = {
version: 1,
layoutId: "card-grid",
breakpoints: { xs: 1, sm: 2, md: 3 },
items: [
{
id: "card-1",
attributes: {
"class": "card",
"data-same-size": "true"
},
content: {
type: "html",
value: `
<div class="card-header">Product Title</div>
<div class="card-body">
<p>Product description here.</p>
</div>
`
}
},
{
id: "card-2",
attributes: {
"class": "card",
"data-same-size": "true"
},
content: {
type: "html",
value: `
<img class="card-img" data-img-src="image.jpg" alt="Product">
<div class="card-header">Another Product</div>
<div class="card-body">
<p>Longer description with more text.</p>
<p>Cards will equalize heights automatically.</p>
</div>
`
}
}
]
};
RSL.JSONLayout.renderLayout('#container', config);
// Cards are now equalized - no manual init() needed!
The Cards component uses a container-based approach:
RSL.Cards.init() scans all .slot-layout containers for cards with data-same-size="true"data-img-src to load before final adjustment| Method | Description |
|---|---|
RSL.Cards.init() |
Initialize all card equalizers on the page (auto-called by JSON API) |
RSL.Cards.create(container) |
Create card equalizer for specific container element |
RSL.Cards.equalize(container) |
Manually trigger height equalization for a container |
RSL.Cards.reset() |
Reset all card heights to auto |
RSL.Cards.instances |
Map of initialized container instances |
RSL.Cards.initFilterBus() |
Initialize FilterBus subscriptions for all cards |
RSL.Cards.destroyFilterBus(card) |
Destroy FilterBus subscription for a specific card |
RSL.Cards.filterSubscriptions |
Map of FilterBus subscriptions for cleanup |
The Cards component integrates with RSL's FilterBus for reactive filtering. Cards can subscribe to FilterBus state changes and automatically show/hide based on filter selections.
RSL.Cards.init() is called. Cards with
data-filter-subscribe attributes will respond to filter changes immediately.
| Attribute | Purpose | Example |
|---|---|---|
data-filter-subscribe |
FilterBus key to listen to | data-filter-subscribe="category" |
data-filter-value |
Value(s) this card matches (comma-separated for multiple) | data-filter-value="tech,design" |
<!-- Cards that respond to FilterBus state -->
<div class="slot-layout" data-cols-md="3">
<div class="slot-item">
<div class="card" data-filter-subscribe="category" data-filter-value="tech">
<div class="card-header">Tech Card</div>
<div class="card-body">Shows when category="tech" or "all"</div>
</div>
</div>
<div class="slot-item">
<div class="card" data-filter-subscribe="category" data-filter-value="design">
<div class="card-header">Design Card</div>
<div class="card-body">Shows when category="design" or "all"</div>
</div>
</div>
<div class="slot-item">
<div class="card" data-filter-subscribe="category" data-filter-value="tech,design">
<div class="card-header">Tech & Design Card</div>
<div class="card-body">Shows for tech OR design OR all</div>
</div>
</div>
</div>
<!-- Filter control (publishes to FilterBus) -->
<select data-filter-publish="category">
<option value="all">All Categories</option>
<option value="tech">Technology</option>
<option value="design">Design</option>
</select>
| Class | Purpose |
|---|---|
.card-filterbus-hidden |
Applied when card should be hidden (set by FilterBus) |
.card-filterbus-initialized |
Applied after FilterBus subscription is set up (enables transitions) |
| Event | Detail | Description |
|---|---|---|
rsl-card:filterbus-update |
{ state: Object, visible: Boolean } |
Fired when FilterBus updates card visibility |
Cards can be filtered by date range when connected to a Date Picker via FilterBus.
Add data-filterbus-date-field to the container and data-date to each card to enable date filtering.
data-filterbus-date-field="date" to the container (e.g., slot-layout)data-date="YYYY-MM-DD" to each card element| Attribute | Applied To | Description |
|---|---|---|
data-filterbus-date-field |
Container | Specifies the data attribute on cards containing dates (e.g., "date" looks for data-date) |
data-date |
Card | The date value for this card. Supports ISO (YYYY-MM-DD), US (MM/DD/YYYY), and European (DD.MM.YYYY) formats. |
<!-- Date Picker publishes to FilterBus -->
<input type="text"
data-rsl-date-picker
data-mode="range"
data-filterbus-publish="dateFilter">
<!-- Container with date field attribute -->
<div class="slot-layout" data-filterbus-date-field="date">
<div class="slot-item">
<div class="card" data-date="2025-12-02">
<div class="card-header">Q4 Report</div>
<div class="card-body">Dec 2, 2025</div>
</div>
</div>
<div class="slot-item">
<div class="card" data-date="2025-12-15">
<div class="card-header">Holiday Sales</div>
<div class="card-body">Dec 15, 2025</div>
</div>
</div>
</div>
| Class | Description |
|---|---|
.card-date-hidden |
Applied when card is outside the selected date range. Uses display: none. |
| Event | Detail | Description |
|---|---|---|
rsl-cards:date-filter |
{ dateFilter, totalCards, visibleCards } |
Fired on the container when date filter is applied |