diff --git a/apps/www/config/docs.ts b/apps/www/config/docs.ts
index 35f47b824a5..1f1352f90a5 100644
--- a/apps/www/config/docs.ts
+++ b/apps/www/config/docs.ts
@@ -147,6 +147,11 @@ export const docsConfig: DocsConfig = {
href: "/docs/dark-mode/vite",
items: [],
},
+ {
+ title: "Astro",
+ href: "/docs/dark-mode/astro",
+ items: [],
+ },
],
},
{
diff --git a/apps/www/content/docs/dark-mode/astro.mdx b/apps/www/content/docs/dark-mode/astro.mdx
new file mode 100644
index 00000000000..01e4ffe4227
--- /dev/null
+++ b/apps/www/content/docs/dark-mode/astro.mdx
@@ -0,0 +1,121 @@
+---
+title: Astro
+description: Adding dark mode to your astro app.
+---
+
+## Dark mode
+
+Astro
+
+
+
+```
+
+### Add a mode toggle
+
+```tsx title="src/components/ModeToggle.tsx"
+import * as React from "react"
+import { Moon, Sun } from "lucide-react"
+
+import { Button } from "@/components/ui/button"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
+
+export function ModeToggle() {
+ const [theme, setThemeState] = React.useState<
+ "theme-light" | "dark" | "system"
+ >("theme-light")
+
+ React.useEffect(() => {
+ const isDarkMode = document.documentElement.classList.contains("dark")
+ setThemeState(isDarkMode ? "dark" : "theme-light")
+ }, [])
+
+ React.useEffect(() => {
+ const isDark =
+ theme === "dark" ||
+ (theme === "system" &&
+ window.matchMedia("(prefers-color-scheme: dark)").matches)
+ document.documentElement.classList[isDark ? "add" : "remove"]("dark")
+ }, [theme])
+
+ return (
+ Astro
+
Vite
+Astro
+