Consent

A cookie consent notice, as a card or a bar.

We use cookies to understand how you use our service. Learn more

Installation

  1. Add the registryOnce per project
  2. Add consent

Usage

Consent doesn't store the choice. Save it in onConsentChange and use open to keep the notice hidden afterward. Read the saved choice in an effect, as above, so server-rendered pages don't flash the notice.

Render it near the start of the page so it comes early in the tab order. It hides once a choice is made, unless you set dismissOnConsent={false}.

Examples

Bar

Given more width, the notice lays out as a single row. Pass your own text as children, and change the buttons with acceptLabel and declineLabel. If it isn't about cookies, give it a matching aria-label.

We use privacy-friendly analytics to see which pages need work. Read the privacy policy

Changing a choice

Control open to show the notice again, such as from a footer link.

We use cookies to understand how you use our service.

Props