-
Currently we include some default spacing values in the Layout components. Is this something we should do or should we remove all default spacing values? We have touched on this discussion before, so here is a summary of some of the points that have been brought up.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 14 replies
-
Default spacing zero
I would like to see |
Beta Was this translation helpful? Give feedback.
-
A couple of thoughts Default spacing 0 pros
Default spacing 0 cons
Sensible default value pros
I can see benefits from both sides here and we have spoken about removing spacing defaults in the past, not just for one off components but all of them, especially when talking about removing 0 values from tokens. My strongest point for keeping the defaults is this: If I were the user they'd help me build faster and have confidence that most of the time they're going to be right. |
Beta Was this translation helpful? Give feedback.
-
Hey folks! I thought I’d share our perspective in Checkout UI Extensions and hopefully contribute to the discussion that could lead to alignment and simplify the shared UI-Extensions components API project coming soon. In Checkout, for low-level components, we consider properties like We do have 2 outliers that contradicts this pattern, but we’ll be correcting them in the upcoming cycles. The BlockStack and InlineStack component (equivalent to your Inline and Stack) currently have a default spacing between its children. The main reason is for developer ergonomics. These components are the most basic way to lay out elements and they are used very often in our apps (to space boxes, block of text, icons, tags, textfield, etc. ). The rationale to include default spacing was to improve the experience of writing the majority of the use cases. Spacing is almost always needed. Make the most common UI easy, and the rest possible kinda thinking. In retrospect, I believe it was a mistake and we’ll be aligning the spacing prop with other components props (ie: no default, additive only) for similar reasons that were shared in this discussion. Boolean typeFor the Modal component we released to 3rd party devs recently, we introduced a new concept that gets us similar benefits as default values, without the default values already set🤪. Modal has no default padding, but developers can set the
We believe this pattern could also apply to the
<BlockStack spacing>
<TextBlock>paragraph 1</TextBlock>
<TextBlock>paragraph 2</TextBlock>
<TextBlock>paragraph 3</TextBlock>
<TextBlock>paragraph 4</TextBlock>
</BlockStack>
<View cornerRadius border padding>
content
</View> This is not yet implemented in our components (only Modal so far), but we’re quite happy with the potentials. Would that be a pattern Polaris (or I guess Admin Extensions UI components) would consider for a shared API down the line? Any thoughts? Thanks y’all! |
Beta Was this translation helpful? Give feedback.
Default spacing zero
<Inline>...</Inline>
has no spacing<Inline gap="2">...</Inline>
has a gap of2
…