Add popser to your shadcn project with one command:
npx shadcn add https://popser.vcui.dev/r/popser.jsonThis installs @vcui/popser, adds a wrapper component, and configures CSS imports.
Add the registry to your components.json:
{
"registries": {
"@vcode-sh": "https://popser.vcui.dev/r/{name}.json"
}
}Then install with:
npx shadcn add @vcode-sh/popserThe registry component wraps <Toaster> with:
- next-themes integration — reads
resolvedThemeand passes it to popser - CSS variable merging — maps shadcn's CSS custom properties to popser's
--popser-*tokens - Sensible defaults —
richColorsenabled,"system"theme - Full prop passthrough — accepts all
ToasterPropsviaPartial<ToasterProps>
After installing via the registry:
import { toast } from "@vcui/popser";
import { Toaster } from "@/components/ui/popser";
export default function Layout({ children }) {
return (
<>
{children}
<Toaster />
</>
);
}
// Anywhere in your app
toast.success("Saved");Pass any ToasterProps to the wrapper:
<Toaster
position="top-center"
limit={5}
timeout={3000}
closeButton="always"
/>The wrapper reads resolvedTheme from next-themes and passes it to popser's theme prop. Dark mode works automatically if you have next-themes configured in your app.
If you're not using next-themes, pass theme manually:
<Toaster theme="dark" />The wrapper component merges shadcn's CSS variables with popser's defaults. Your shadcn theme colors apply automatically. If you want to override specific tokens, use CSS custom properties:
:root {
--popser-radius: var(--radius);
--popser-bg: hsl(var(--card));
--popser-fg: hsl(var(--card-foreground));
--popser-border: hsl(var(--border));
}The registry component requires:
@vcui/popser(installed automatically)next-themes(installed automatically)@vcui/popser/styles(imported in the component)
If you prefer not to use the registry, install manually:
npm install @vcui/popserThen import the styles and use <Toaster> directly. No wrapper needed if you don't want next-themes integration.