Customize styles with classNames
mainYou can override the default styling of any element in the cookie consent UI using the classNames prop. This prop accepts an object where keys correspond to specific UI elements. It is compatible with any CSS framework, including Tailwind CSS and Bootstrap.
Element Groups:
- Button Elements:
acceptButton,declineButton,manageButton,manageCancelButton,manageSaveButton. - Container Elements:
bannerContainer,popupContainer,modalContainer,manageCookieContainer. - Content Elements:
bannerContent,popupContent,modalContent,bannerTitle,popupTitle,modalTitle,bannerMessage,popupMessage,modalMessage. - Manage Cookie UI Elements:
manageCookieTitle,manageCookieMessage,manageCookieCategory,manageCookieCategoryTitle,manageCookieCategorySubtitle,manageCookieStatusText,manageCookieToggle,manageCookieToggleChecked. - Other Elements:
privacyPolicyLink,floatingButton,floatingButtonCloseButton.
<CookieManager
classNames={{
acceptButton: "bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded-lg",
declineButton: "bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded-lg",
manageButton: "border-2 border-blue-500 text-blue-500 font-bold py-2 px-4 rounded-lg hover:bg-blue-50",
// ... other class names
}}
>
{children}
</CookieManager>