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
I'm using Flowbite in a Rails/Turbo app. I'd like a user to be able to click a record in a list, and have the resulting turbo frame loaded into a drawer component which then opens. What's the recommended way to accomplish this?
It's simple enough using a Modal (versus a Drawer), as a modal is displayed/open by default. In other words, the turbo frame just needs to include the modal markup which gets added to the DOM and, bam, it works—no JS required. But the drawer component is a bit more complicated, and I'm not sure how to trigger it open without something like below (which kinda rewrites the functionality of Turbo):
// Fetch deal details via Turbo streamconstresponse=awaitfetch(`/deals/${dealId}`,{headers: {Accept: "text/vnd.turbo-stream.html"},});if(response.ok){consthtml=awaitresponse.text();this.dealContentTarget.innerHTML=html;this.drawer=FlowbiteInstances.getInstance('Drawer','dealDrawer');this.drawer.show();}else{console.error("Failed to fetch deal details");}
Am I overthinking this? Is there a simpler way to trigger the drawer open with dynamic content without having to rewrite simple Turbo behavior (as seen above)?
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
-
I'm using Flowbite in a Rails/Turbo app. I'd like a user to be able to click a record in a list, and have the resulting turbo frame loaded into a drawer component which then opens. What's the recommended way to accomplish this?
It's simple enough using a Modal (versus a Drawer), as a modal is displayed/open by default. In other words, the turbo frame just needs to include the modal markup which gets added to the DOM and, bam, it works—no JS required. But the drawer component is a bit more complicated, and I'm not sure how to trigger it open without something like below (which kinda rewrites the functionality of Turbo):
Am I overthinking this? Is there a simpler way to trigger the drawer open with dynamic content without having to rewrite simple Turbo behavior (as seen above)?
Thanks in advance, all!
Beta Was this translation helpful? Give feedback.
All reactions