Daisy UI theme with tailwind css
Tips for changing theme when using Daisy UI and tailwind css
Tailwind config
When we use darkmode, tailwind.config.ts should be use selector and data-theme=dark. Because, Daisy UI and theme-change will make change on data-theme attribute and not using class.
import type { Config } from "tailwindcss";
const config: Config = {
darkMode: ["selector", "[data-theme=dark]"],
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
daisyui: {
themes: [
"light", "dark", "black"
],
},
plugins: [
require("daisyui"),
require('@tailwindcss/typography'),
],
};
export default config;
Publish Date: 2024-05-07, Update Date: 2024-05-08