Docs
Theme Toggle Animations
Theme Toggle Animations
Animations when your theme Changes cool right ?
References
Read Docs to more
Installation
components/ui/theme-toggle-button.tsx
npx shadcn@latest add "http://skiper-ui.com/registry/theme-toggle-button.json"
This will add 4 files to components/ui
wrap your rootLayout layout.tsx
import { ThemeProvider } from "@/components/ui/theme-provider"
export default function RootLayout({ children }: RootLayoutProps) {
return (
<>
<html lang="en" suppressHydrationWarning>
<head />
<body>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
>
{children}
</ThemeProvider>
</body>
</html>
</>
)
}
Use the toggle button anywhere
import ThemeToggleButton from "@components/ui/theme-toggle-button"
<ThemeToggleButton />
Props
Prop | Description | Type | Default Value |
---|---|---|---|
variant | Specifies the variant type. E.g., 'circle', 'circle-blur' , 'gif' | polygon | circle-blur |
start | Sets the starting point (e.g., top left, center) | string | top-left |
url | The URL associated with the link only for gif variant. | string | "" |
showLabel | only for dev purpose to check the props set | boolean | false |
Here's the fun part
you can also add transparent gif's Find some Cool Gif's here
<ThemeToggleButton variant="gif" url="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMWI1ZmNvMGZyemhpN3VsdWp4azYzcWUxcXIzNGF0enp0eW1ybjF0ZyZlcD12MV9zdGlja2Vyc19zZWFyY2gmY3Q9cw/Fa6uUw8jgJHFVS6x1t/giphy.gif" />
<ThemeToggleButton variant="gif" url="https://media.giphy.com/media/ArfrRmFCzYXsC6etQX/giphy.gif?cid=ecf05e47kn81xmnuc9vd5g6p5xyjt14zzd3dzwso6iwgpvy3&ep=v1_stickers_search&rid=giphy.gif&ct=s"/>