Replies: 2 comments
-
|
Some initial thoughts, perhaps we are missing a layout primitive that would handle this? By adding |
Beta Was this translation helpful? Give feedback.
-
I like this description of what Box is meant to be. I'm not sure we're missing a primitive but perhaps these could be props to on our layout components vs on Box itself. I could see I'd like to make sure we have a definitive use case for adding this kind of feature to these components before going ahead with this though |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
Should we add a
displayprop to some of our components so that they can set their outer layout?Context
HTML elements have two display types: inner and outer. Inner display types set the layout of an element's children (ex.
gridandflex). Our new foundational layout components seem to mostly deal with setting the component's children (ex.Inline,Grid,Tiles)Outer display types set the layout of the element itself (ex.
inlineandblock). Right now, we're not able to set the outer display type of our components. There are also precomposed display types that set the inner and outer properties togetherdisplay: inline-flex. You can also use the syntaxdisplay: inline flex, but this is not well supported in all browsers just yet.So, the question is: do we think we'll need or want to be able to set an element's outer display type directly?
Prototype
I prototyped allowing a
displayproperty on theBoxcomponents to set thedisplayCSS property on this branch. I copied a list of all display values, but if we want to allow this prop then I think we can narrow this down only to the outer display types. This will mean that users will still need to use the new Layout components in most cases.Something more like this:
Background
I stumbled on this question while trying to rebuild the
Tagcomponents using our new layout components. TheTagcomponents can render a few different ways: as a<span>with nestedaorspanchildren and an optional inlinebuttonchild. Or it can return abutton.The
Tagis currently styled usingdisplay: inline-flex, which sets both the outer and inner display type for the rendered element. Trying to recreate this solution using theInlineandBoxcomponents andspanisn't working because we can't set the height of an inline element.spanrendered fromBoxbuttonrendered insidespanThis led me down the rabbit hole of of inner and outer display types described above.
Beta Was this translation helpful? Give feedback.
All reactions