You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I would like to thank you for making this awesome ui library.
I am currently going over a tutorial with react+react-daisyui. The app runs without issue/s but the react-daisyui Modal component will not close when I click outside.
In my App.js file I used the Modal component: import { useState } from "react"; import { Button, Modal } from "react-daisyui"; function App() { const [visible, toggleVisible] = useState(false); return( <div className="App"> <Button className="w-32" onClick={() => toggleVisible(!visible)}> Open Modal </Button> <Modal open={visible} backdrop={true} > <Modal.Header className="font-bold">Hello!</Modal.Header> <Modal.Body>Press ESC key or click outside to close</Modal.Body> </Modal> </div> ); } export default App;
I am attaching a gif as well.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First of all, I would like to thank you for making this awesome ui library.
I am currently going over a tutorial with react+react-daisyui. The app runs without issue/s but the react-daisyui Modal component will not close when I click outside.
Here are the content of my package.json.
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"autoprefixer": "^10.4.15",
"daisyui": "^3.7.5",
"postcss": "^8.4.29",
"react": "^18.2.0",
"react-daisyui": "^4.1.1",
"react-dom": "^18.2.0",
"react-router-dom": "^6.16.0",
"react-scripts": "5.0.1",
"tailwindcss": "^3.3.3",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
tailwind.config.js file:
/** @type {import('tailwindcss').Config} /
module.exports = {
content: [
'node_modules/daisyui/dist/**/.js',
'node_modules/react-daisyui/dist//*.js',
'./src//.{js,jsx,ts,tsx}',
'./src/layout/.tsx',
'./public/index.html',
],
theme: {
extend: {},
},
plugins: [require("daisyui")],
}
In my App.js file I used the Modal component:
import { useState } from "react"; import { Button, Modal } from "react-daisyui"; function App() { const [visible, toggleVisible] = useState(false); return( <div className="App"> <Button className="w-32" onClick={() => toggleVisible(!visible)}> Open Modal </Button> <Modal open={visible} backdrop={true} > <Modal.Header className="font-bold">Hello!</Modal.Header> <Modal.Body>Press ESC key or click outside to close</Modal.Body> </Modal> </div> ); } export default App;
I am attaching a gif as well.
Thank you for your help and support. Gbu all!
Beta Was this translation helpful? Give feedback.
All reactions