Comments (3)
Hi @gjovanov,
Whenever checkbox is checked, drawer opens and whenever it's unchecked, drawer gets closed. There's no trick.
As you can see here I'm controling the drawer of daisy.js.org using the checkbox.
It's a Vue project tho. I'm not sure how Svelte works but if you manage to check/uncheck the checkbox somehow, it will work. Maybe your Svelte code is changing the virtual DOM somehow and is not effecting the actual checkbox. Unfortunately I don't have any experience with Svelte.
from daisyui.
@gjovanov Have you tried using bind:checked={checked}
instead of checked={checked}
I found this example and it seems to only work with bind:checked
from daisyui.
Hey @saadeghi ,
thanks for the suggestion.
Svelte doesn't have a Virtual DOM and it's more like a Compiler that compiles the reactivity into Vanilla JS. But, indeed, the issue was related to Svelte specifics with the bindings.
bind:checked={checked}
works whereat checked={checked}
doesn't. Still no idea why.
But in case when using a writable store like this:
const checked = writable(false)
then both of them work (notice the $ sign in the binding):
<input id="my-drawer1" type="checkbox" class="drawer-toggle" checked={$checked}>
<input id="my-drawer2" type="checkbox" class="drawer-toggle" bind:checked={$checked}>
Anyways, sorry to bother you with issues not related to Daisy UI.
The good news there is a way to manipulate the state of components like drawer
, accordion
etc via the state if its checkbox.
Thanks again..
Closing...
from daisyui.
Related Issues (20)
- docs: Is there any way to change the 'base' value at runtime? HOT 2
- bug: Glass Utility is not working in firefox HOT 6
- bug: Issue disabling background color HOT 6
- bug: countdown component value positioning error HOT 4
- docs: Theme Controller using a swap has incorrect HTML example HOT 2
- docs: I think there is a typo. HOT 1
- bug: Buttons in modals have unexpected borders when content behind them is focused HOT 3
- bug: Input components with parent labels not working when disabled HOT 4
- bug: Checkbox input not responsive if checked value is "true" HOT 3
- bug: nested different types of `join` conflict with one another HOT 2
- bug: DaisyUI doesn't detect classes when using template litterals HOT 2
- bug: Step Numbers not hidden in Drawer HOT 3
- bug: prefix doesnt work on color utilities HOT 2
- docs: toast HOT 3
- bug: Failed to switch themes in mobile browser. HOT 4
- bug: show sidebar content when using drawer-end class and press 'tab' HOT 2
- bug: I cannot keep the lines of the timeline component on the left or right side HOT 2
- bug: Tailwind plugin causes build failures for next@canary HOT 2
- bug: Theme colors do not change on theme change in Nuxt3 HOT 1
- docs: daisyui.com index page animations make navigation difficult HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from daisyui.