Skip to content

Responsive Design

The banner must be fully usable on mobile viewports. The Reject button must never be hidden or obscured at any screen width.

The banner uses flex-wrap: wrap on .ag-btns out of the box. At narrow viewports, the three consent buttons stack vertically. This behavior is intentional and GDPR-correct — all three buttons remain equally accessible.

The template’s defaultLayout also matters:

  • bar layout → anchored to bottom, full width — requires no responsive adjustment for most sites.
  • dialog layout → centered with max-width — shrinks with the viewport on mobile.
  • floating layout → corner card — fixed position, adapts naturally on mobile.

Kookiok does not enforce fixed breakpoints — the banner is fluid. Use @media queries in your custom CSS to adjust at your site’s breakpoints.

Recommended adjustment points:

Viewport widthTypical adjustment
< 480pxReduce padding on .ag-banner-inner
< 600pxLet .ag-btns stack fully (already default via flex-wrap)
< 768pxConsider reducing heading font size

The default wrapping behavior works for most sites. If you need to enforce explicit stacking:

Force vertical stack on small screens
@media (max-width: 540px) {
.ag-btns {
flex-direction: column;
}
.ag-btn {
width: 100%;
}
}
Compact mobile layout
@media (max-width: 480px) {
.ag-banner-inner {
padding: 14px;
}
.ag-title {
font-size: 16px;
}
.ag-desc {
font-size: 13px;
margin-bottom: 10px;
}
.ag-btns {
gap: 8px;
}
.ag-btn {
min-height: 44px; /* Keep 44px minimum for WCAG AA touch target */
padding: 10px 14px;
}
}

The .ag-detail-grid uses a CSS grid that automatically collapses on mobile. If you override the grid layout:

Force single column on mobile
@media (max-width: 600px) {
.ag-detail-grid {
grid-template-columns: 1fr;
}
}

On mobile, the full-viewport overlay (--surface-overlay on .ag-overlay) is especially important to prevent accidental interaction with page content. Keep the overlay opaque enough to indicate modal state. A bar or a floating banner with “Dim the page behind the banner” switched off has no overlay to style.

Stronger overlay on mobile
@media (max-width: 768px) {
:host {
--surface-overlay: rgba(10, 15, 30, 0.75);
}
}