Offer an option for split collapse toggle and content? #4479
Closed
Acccent
started this conversation in
Ideas / feature requests
Replies: 1 comment 7 replies
-
|
You mean this? |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the
collapsecomponent needs a structure like this:(This structure is roughly the same regardless of whether we use the focus, checkboxs or details variants.)
It would be useful to be able to put the toggle outside of the parent.
My use case is for navbars, which on mobile often have a lines-button that opens a full-width menu.
See example on bootstrap's documentation
I'd like to suggest adding a way to add this functionality, which would synergize well with daisyUI's own navbar componet. Here's a proposed structure:
I think this should be doable without too many changes, essentially in the collapse content source something like this:
&:is( [open], [tabindex]:focus:not(.collapse-close), [tabindex]:focus-within:not(.collapse-close) ), &:not(.collapse-close):has(> input:is([type="checkbox"], [type="radio"]):checked), + .collapse-toggle-parent:has(.collapse-title:is(:focus, :checked)) + &:not(.collapse-close) { grid-template-rows: max-content 1fr; }(Among other changes. Also I haven't tested this at all, just showing how I'd approach it.)
(Another approach would be to require a new parent div, which would be a bit more flexible but require extra markup.)
Beta Was this translation helpful? Give feedback.
All reactions