The empty div tags come from the transitions--each <Transition> and <TransitionChild> component renders exactly one div. In the React/Vue versions you have the ability to do as={Fragment} to not render anything and have the transition classes applied to the child component, but that's impossible to do directly in Svelte and would need some kind of more elaborate workaround (like exposing a prop getter or maybe for transitions an action which you could apply). At that point I'm not sure the increase in complexity is worth it.
The main downside is just when converting Tailwind UI snippets, I think. In cases where they use as={Fragment} you might need to pull some of the CSS classes up to the <Transition> / <TransitionChild>. In your case, try adding a class= prop to the problematic transition and duplicating or replacing some of the classes there.
Looking at your snippet, if the problematic element is the <div class="relative flex-1 flex flex-col max-w-xs w-full pt-5 pb-4 bg-indigo-700">, you can just remove that div and move all of its classes to the parent <TransitionChild>.
@rgossiaux This is a simplified version of a side bar from Tailwind UI. Make sure you are in response mode for a smaller screen sm: and you will see that the generated <div class = " ">. This sidebar should be full height of screen a fill out wider.
from svelte-headlessui.
Comments (6)
Thanks.
The empty div tags come from the transitions--each
<Transition>
and<TransitionChild>
component renders exactly one div. In the React/Vue versions you have the ability to doas={Fragment}
to not render anything and have the transition classes applied to the child component, but that's impossible to do directly in Svelte and would need some kind of more elaborate workaround (like exposing a prop getter or maybe for transitions an action which you could apply). At that point I'm not sure the increase in complexity is worth it.The main downside is just when converting Tailwind UI snippets, I think. In cases where they use
as={Fragment}
you might need to pull some of the CSS classes up to the<Transition>
/<TransitionChild>
. In your case, try adding aclass=
prop to the problematic transition and duplicating or replacing some of the classes there.Looking at your snippet, if the problematic element is the
<div class="relative flex-1 flex flex-col max-w-xs w-full pt-5 pb-4 bg-indigo-700">
, you can just remove that div and move all of its classes to the parent<TransitionChild>
.from svelte-headlessui.
Can you share the relevant code?
from svelte-headlessui.
@rgossiaux Yes, working on it.
from svelte-headlessui.
https://pastebin.com/3A258fyz
from svelte-headlessui.
@rgossiaux This is a simplified version of a side bar from Tailwind UI. Make sure you are in response mode for a smaller screen
sm:
and you will see that the generated<div class = " ">
. This sidebar should be full height of screen a fill out wider.from svelte-headlessui.
@rgossiaux Cool, thanks! I had the feeling that was gonna be the case but I wanted to check in before I committed. Thanks again for your awesome work.
from svelte-headlessui.
Related Issues (20)
Recommend Projects
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
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
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.