Skip to content

Instantly share code, notes, and snippets.

@Xeven777
Created March 12, 2025 16:37
Show Gist options
  • Save Xeven777/bfe0f5313d6fd3500449094b3ea3610e to your computer and use it in GitHub Desktop.
Save Xeven777/bfe0f5313d6fd3500449094b3ea3610e to your computer and use it in GitHub Desktop.
Toaster With Theme support
'use client';
import { useTheme } from 'next-themes';
import { Toaster } from '@/components/ui/sonner';
const ToasterwithTheme = () => {
const { theme } = useTheme();
return (
<Toaster
richColors
closeButton
theme={theme === 'dark' ? 'dark' : 'light'}
/>
);
};
export default ToasterwithTheme;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment