Compact dark cookie banner in WordPress
A rounded dark bar floating at the bottom of the screen, text on the left and buttons on the right on large screens.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Bandeau de cookies sombre et compact
* Description: Une barre sombre arrondie qui flotte en bas de l'écran, texte à gauche et boutons à droite sur grand écran. Ajoute la composition « Bandeau de cookies sombre et compact » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-cookies-sombre-compact
*<!-- wp:html -->
<div data-consent-root>
<section class="cks" data-consent aria-labelledby="cookies-sombre-compact-title">
<h2 id="cookies-sombre-compact-title" class="cks__title">Nous respectons vos choix</h2>
<p class="cks__text">Avec votre accord, nous utilisons des cookies pour mesurer l'audience et personnaliser la publicité. Vous pouvez accepter, refuser ou choisir par catégorie, et changer d'avis à tout moment. <a href="#politique-cookies" class="cks__link">Politique de cookies</a></p>
<fieldset id="cookies-sombre-compact-panel" class="cks__panel" data-consent-panel hidden>
<legend class="cks__legend">Vos choix par catégorie</legend>
<div class="cks__option">
<input id="cookies-sombre-compact-necessary" type="checkbox" checked disabled class="cks__input">
<label for="cookies-sombre-compact-necessary" class="cks__label">Cookies nécessaires<span class="cks__desc">Panier, connexion et sécurité : toujours actifs, ils ne nécessitent pas de consentement.</span></label>
</div>
<div class="cks__option">(() => {
if (!true) return;
const STORAGE_KEY = "forge-consent";
// The CNIL recommends asking again after six months.
const MAX_AGE = 1000 * 60 * 60 * 24 * 182;
function readConsent() {
try {
const stored = JSON.parse(localStorage.getItem(STORAGE_KEY));
return stored && Date.now() - Date.parse(stored.date) < MAX_AGE ? stored : null;
} catch {
return null;:root {
--ck-cookies-sombre-compact-bg: #111216;
--ck-cookies-sombre-compact-text: #f4f5f7;
--ck-cookies-sombre-compact-muted: #b2b6c0;
--ck-cookies-sombre-compact-line: #2c2f38;
--ck-cookies-sombre-compact-btn: #f4f5f7;
--ck-cookies-sombre-compact-btn-text: #111216;
--ck-cookies-sombre-compact-accent: #f4f5f7;
--ck-cookies-sombre-compact-ring: #fcd34d;
--demo-cookies-sombre-compact-bg: #e7e8ec;
--demo-cookies-sombre-compact-text: #111216;
--ck-cookies-sombre-compact-radius: 8px;Free component: copy it freely, including for commercial projects.
Other cookie banners components in WordPress
Cookie banners components in WordPress
An understated banner with square corners and a thick rule, suited to local authorities, firms and public institutions.
- Tailwind
- React
- CSS
- WordPress

A floating card in the bottom-left corner, discreet yet always visible.
- Tailwind
- React
- CSS
- WordPress

A banner at the top of the page, in the document flow, that never hides content.
- Tailwind
- React
- CSS
- WordPress

A full-width banner pinned to the bottom of the screen, with refuse, customize and accept on the same level.
- Tailwind
- React
- CSS
- WordPress