Search
Search components and blocks
Built from the Dialog and Switch components.
Cookie Preference Dialog
A real-world composition, not a new primitive — the compact Dialog, the Switch, per-category icons, and the ActionSwapButton for the save action, which confirms 'Saved!' before the dialog closes itself.
Install
$ pnpm dlx shadcn@latest add @ditherui/cookie-preferences-dialog
Props
PropTypeDefault
NecessarySwitch checked disabled, ShieldCheckIconalways onAnalytics / Marketing / FunctionalSwitch + onCheckedChange, per-category iconper-category stateReject allresets every optional category to off, closes immediately—Save preferencesActionSwapButton — confirms "Saved!", then closes the dialogresetAfter: 1100ms