Consent Group

Consent Group is a copy-paste React component that stops pre-ticked consent bundled with terms before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/consent-group
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsPre-ticked consent bundled with terms

Was this component page useful?

How do I install Consent Group?

pnpm dlx shadcn@latest add @bollard/consent-group

The files land in your project. They're yours to edit.

How do I use Consent Group in React?

consent-group-usage.tsx
import { ConsentGroup, type ConsentChoices, type ConsentItem, type ConsentRecord } from "@/components/ui/consent-group"

<ConsentGroup
  items={items}
  version="2026-10"
  value={choices}
  name="consent"
  onValueChange={(next, entry) => {
    setChoices(next)
    setRecord(entry)
  }}
/>

What input mistakes does Consent Group catch?

  • Pre-ticked consent boxes
  • Optional purposes bundled with required terms
  • "Accept all" ticking more than the person read, by listing it first
  • Changes to consent wording, via a version and a fingerprint in each record

What props does Consent Group accept?

ConsentGroup props
PropTypeDefault
items* (required)

The consent checkboxes, required and optional.

ConsentItem[]—
version* (required)

Version of this consent text, stored in every record.

string—
value

Controlled choices, e.g. a person's saved record when they edit it. There is deliberately no `defaultValue`: uncontrolled, every box starts unticked.

ConsentChoices—
onValueChange

Called with the new choices and the record to store.

(choices: ConsentChoices, record: ConsentRecord) => void—
name

Adds a hidden input carrying the JSON record, for plain form posts.

string—
legend

Visible title for the group.

string"Your choices"
requiredHeading

Heading for the required items.

string"Needed for your account"
optionalHeading

Heading for the optional purposes.

string"Optional, your choice"
acceptAllLabel

Text for the accept-all button.

string"Accept all"
declineLabel

Text for the decline-optional button.

string"Decline optional"
acceptAllText

`{list}` is what Accept all would tick.

string"This also ticks {list}."
confirmLabel

Text for confirming accept-all.

string"Tick them"
cancelLabel

Text for cancelling accept-all.

string"Cancel"
recordedText

`{when}` and `{version}` are filled in.

string"Recorded {when} · text {version}"

* required. Also accepts the native props of <fieldset> (className, aria-*, data-*…), passed through to it.

How is Consent Group accessible?

  • Required and optional sections are role="group" with headings via aria-labelledby
  • Each checkbox has a <label> and aria-describedby to its description
  • Accept-all confirmation is a labelled group; focus moves to Confirm and Escape cancels
  • The required marker is aria-hidden; requirement is stated in the heading

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Store consent records server-side with the exact text version shown, and let users withdraw as easily as they gave consent.

  • The fingerprint is a short FNV-1a hash for spotting wording changes, not a tamper-proof signature
  • Records are passed to you; storing them and honouring withdrawal is up to your backend
  • Not legal advice: whether consent is valid depends on your jurisdiction and context

What validation rules apply to Consent Group?

Rules not yet verified against an official source.

Not verified against the primary source on 2026-10-17: EUR-Lex could not be fetched. Recital 32 text ("Silence, pre-ticked boxes or inactivity should not therefore constitute consent") was read on a secondary reproduction only. Informational, not legal advice. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does Consent Group stop?

Pre-ticked consent bundled with terms

Also known as

consent · checkbox · gdpr · dpdp · marketing emails · newsletter opt-in · cookie consent · terms checkbox

What dependencies does Consent Group require?

Consent Group facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameConsent Group
Registry identifier@bollard/consent-group
Install commandnpx shadcn@latest add @bollard/consent-group
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Consent Group

What form validation mistake does Consent Group catch?

Consent Group prevents pre-ticked consent bundled with terms. Consent checkboxes that are never pre-ticked and keep required terms apart from optional purposes, and record what was agreed and when. Catches: Pre-ticked consent boxes, Optional purposes bundled with required terms, "Accept all" ticking more than the person read, by listing it first, Changes to consent wording, via a version and a fingerprint in each record. Limitation: validate consent-group schemas on backend.

How do I install consent-group with shadcn?

Run `npx shadcn@latest add @bollard/consent-group`. Sources added: registry/default/consent-group/consent-group.tsx. Package requirements: lucide-react.

What props customize Consent Group?

Consent Group accepts `items`, `version`, `value`, `onValueChange`, `name`. Configures consent, checkbox, gdpr behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of consent-group?

The fingerprint is a short FNV-1a hash for spotting wording changes, not a tamper-proof signature. Records are passed to you; storing them and honouring withdrawal is up to your backend. Not legal advice: whether consent is valid depends on your jurisdiction and context Server requirement: Store consent records server-side with the exact text version shown, and let users withdraw as easily as they gave consent.

How does Consent Group meet accessibility guidelines?

Required and optional sections are role="group" with headings via aria-labelledby. Each checkbox has a <label> and aria-describedby to its description. Accept-all confirmation is a labelled group; focus moves to Confirm and Escape cancels. The required marker is aria-hidden; requirement is stated in the heading. Minimizes errors: pre ticked checkbox consent, bundled marketing consent.

Which components pair with Consent Group?