Stack generates a lot of extra Markup
See original GitHub issueI watched the conference talk of Mark last night and found it very interesting. One flag to me was that Stack wraps a Div for every child. Seems like an overload of unnecessary markup. The approach in our Design system was to apply a default stack (1 rem down) to our Atomic components. With a BEM modifier of $–no-stack as an optional prop noStack
If we need spacing to be grouped, we use a Block
and allow that to have a variety of stack down sizes.
https://github.com/seek-oss/braid-design-system/blob/master/lib/components/Stack/Stack.tsx
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Avoid extra markup in Sharepoint Web Parts
I dont want extra divs to be generated. I just want the markup starting from "fii-twitter-feeds". How can I achieve that? sharepoint-server ...
Read more >How to deal with extra markup used for angular directives?
My css expects th <app-grouped-button> elements to be direct descendants of <app-button-group> , so they can be laid out as flexbox items. But...
Read more >Lecture 2, The basics of the web stack
In this course we will use HTML to create our data visualizations. HTML stands for “HyperText Markup Language”. 25 years ago, that used...
Read more >What is the JAM Stack: JavaScript, APIs and Markup - WebriQ
JAM stack focuses on the front end build, eschewing server-side functions as much as possible. Jamstack defines a group of technologies and a ......
Read more >What is Jamstack? JavaScript, APIs, and Markup (JAM)
Jamstack is a term that describes a modern web development architecture based ... the number of requests sent to a server and thus...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for raising this question. It’s definitely a valid concern.
An alternative approach would be to use a selector like
> *:not(:first-child)
to add top padding to all child nodes via CSS, but there are a couple of tradeoffs here:Box
. We’d have to create a separate atomic class for every item in our space scale, for each of our viewport sizes.However, I can definitely see an argument that this tradeoff is worth it:
Stack
is used a lot in a single page, the extra CSS will be smaller than the additional HTML.Stack
instead. We’ve run into this a bit, and in practice it kinda feels like a poor separation of concerns.On reflection, I can see us changing approaches here, but we’ll discuss this a bit further internally.
Still toying around, mostly have just made the layout components (not buttons etc.)
Will be making it available soon, can shoot you a link by then?
Tried to make api, dom structure and styling more or less identical