Master the data-driven responsive grid in 5 minutes
Instead of rigid column classes like .col-4 and .col-8, RSL uses a flexible data-driven system:
data-cols-* attributesdata-cols-md="3" applies to md, lg, xl, xxl automatically
Item 1
Item 2
Item 3
| Breakpoint | Screen Width | Attribute |
|---|---|---|
| xs (Extra Small) | 0 - 575px | data-cols-xs="N" |
| sm (Small) | 576px - 767px | data-cols-sm="N" |
| md (Medium) | 768px - 991px | data-cols-md="N" |
| lg (Large) | 992px - 1199px | data-cols-lg="N" |
| xl (Extra Large) | 1200px - 1399px | data-cols-xl="N" |
| xxl (2X Large) | 1400px+ | data-cols-xxl="N" |
data-cols-md="4", it automatically applies to md, lg, xl, and xxl—unless you override a larger breakpoint.
Item
data-cols-xs, then add larger breakpoints as neededdata-cols-md="3"—no need for complex mathdata-slots-* for fractional widths (1/3, 2/3) instead of equal columns.slot-layout nesting for complex layoutsGrid layouts are calculated when the page loads and on window resize. However, if you're using grids inside components that show/hide content (like tabs, accordions, or modals), you may need to trigger a layout recalculation when the content becomes visible.
When grid layouts are inside hidden elements (display: none), they can't be properly measured during the initial calculation. This commonly happens with:
The layout.js script automatically recalculates grids on window resize events. You can leverage this to force recalculation when content becomes visible:
// When showing previously hidden content with grids inside
function showContent(contentElement) {
// Make content visible
contentElement.classList.add('active');
// Trigger layout recalculation
window.dispatchEvent(new Event('resize'));
}
function activateTab(tab, content) {
// Hide all tab panels
document.querySelectorAll('.tab-content').forEach(panel => {
panel.classList.remove('active');
});
// Show selected tab panel
content.classList.add('active');
// Recalculate any grids inside the newly visible tab
const grids = content.querySelectorAll('.slot-layout');
if (grids.length > 0) {
window.dispatchEvent(new Event('resize'));
}
}
✓ Best Practice: Always trigger a resize event when revealing content that contains .slot-layout grids. This ensures proper column calculation and responsive behavior.
RSL Grid is accessibility-friendly:
<div> containers