shadcn.io is not affiliated with official shadcn/ui
Consent Check Alert Banner Block for Svelte
An acknowledge-once callout for a newsletter platform: a card in card with an info icon, a heading, one sentence and a footer whose checkbox rewrites the outline button from Got it to Dismiss permanently.
Installation
Overview
An acknowledge-once callout for Svelte with Ark UI, for a notice people should read once and then be able to silence. A muted shell with + marks on its corners holds a raised panel: an info icon, a short heading and one sentence about product updates moving to a monthly digest. Under a hairline, a footer puts a "Don't show this again" checkbox at the start and an outline button at the end. Ticking the box rewrites the button from "Got it" to "Dismiss permanently", and either word folds the whole block away with a CSS height transition. The status colour stays on the icon and on one hairline along the panel's top edge; the rest follows your theme. The page's rails and top rule come from the Guides spine. It's built from Guides, Checkbox, Label and Button, with your theme's tokens for every colour. For policy changes, beta terms, onboarding notices and any message that people should be able to turn off.
FAQ
Is this a dialog? Does it trap focus?
No. It is a section named by its heading, in the flow of the page, with real buttons and a checkbox, so nothing is trapped and nothing blocks the page behind it. Screen readers list it with the page's regions and people can jump past it. If your notice appears later, after a save or a sync, put role="status" on an element that is in the page from the start and fill its text when the notice arrives.
How does the checkbox rewrite the button?
The checked state lives in the block. Both words, "Got it" and "Dismiss permanently", sit in one grid cell inside the button and the unused one is invisible, so the button keeps one width and nothing around it moves when you tick the box. Screen readers hear only the visible word. The label wraps the box, so clicking the words toggles it too.
Does Dismiss permanently remember anything?
Not in this block: it forgets on purpose, so the preview always shows it. To remember, set a cookie named after the notice (notchspring-digest-notice) in the dismiss handler when the box is checked, and skip rendering the block when your server sees it. Reading a stored value after the first paint would show the card and then fold it, moving the page, so decide on the server.
Where does the keyboard go after it closes?
The button can't keep the focus once the card is folded and inert, so focus moves to a short visually hidden line at the same spot, "Digest notice dismissed.", which screen readers read out. The next Tab carries on from there.