Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-daisyui
Advanced tools
daisyUI components built with React, Typescript and TailwindCSS
📖 Check out our Storybook | 🎲 Try it with CodeSandbox
🙋 Need help or have a suggestion? Join our discord!
Make sure you've installed TailwindCSS and daisyUI.
Install the package with npm or yarn:
npm install react-daisyui
or
yarn add react-daisyui
To prevent TailwindCSS from purging your styles, add the following line to your tailwind.config.js:
module.exports = {
content: [
'node_modules/daisyui/dist/**/*.js',
'node_modules/react-daisyui/dist/**/*.js',
],
plugins: [require('daisyui')],
}
Modify transpilePackages
in your next.config.js
file:
const nextConfig = {
// ... your content here
transpilePackages: ['react-daisyui'],
reactStrictMode: true,
}
module.exports = nextConfig
npm install next-transpile-modules
And import the package inside your next.config.js
file:
const withTM = require('next-transpile-modules')(['react-daisyui'])
Finally, you can wrap your module.exports using withTM like so:
module.exports = withTM({
//... your content here
reactStrictMode: true,
})
Import react-daisyui components within your component files:
import { Button } from 'react-daisyui'
export default (props) => {
return <Button color="primary">Click me!</Button>
}
To apply a theme (or multiple themes) to a page or components, import the Theme component and wrap your content:
import { Theme, Button } from 'react-daisyui'
export default (props) => {
return (
<>
<Theme dataTheme="dark">
<Button color="primary">Click me, dark!</Button>
</Theme>
<Theme dataTheme="light">
<Button color="primary">Click me, light!</Button>
</Theme>
</>
)
}
Use tools like the official daisyUI Theme Generator or daisyUI Theme Builder to easily create your own themes.
We're looking for contributors to help write stories and unit tests for components.
Run npm run generate component ${your_new_component_name}
. The generator will ask a few questions and setup the component for you.
When you'e done, export the component from index.tsx
and open a PR.
Check out the official daisyUI examples. 👈
This project is licensed under the MIT License - see the LICENSE.md file for details.
FAQs
react-daisyui - DaisyUI components built with React 🌼
The npm package react-daisyui receives a total of 8,573 weekly downloads. As such, react-daisyui popularity was classified as popular.
We found that react-daisyui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.