Skip to content

How does the drawer component work? #342

Answered by saadeghi
shawnlikescode asked this question in Q&A
Discussion options

You must be logged in to vote

@shawnlikescode drawer works with the hidden checkbox and labels are there to control the checkbox so there wont be any JS needed. however, labels don't really change the value of the checkbox when clicked. so If you want to control the open/close functionality with JS, you can use onClick for the buttons and also drawer-overlay to handle the value of checkbox.
Here's an example using React: https://codesandbox.io/s/daisyui-drawer-react-ne6mk

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kaushalyap
Comment options

@saadeghi
Comment options

Answer selected by saadeghi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants