skip to content

In a design system, what are inset, stack and inline spacing, and why define them as separate roles?

level: juniorimportance: should knowfreq 40%

answer

  1. inside, below, beside
  2. container edge to content
  3. vertical between stacked items
  4. horizontal between items in a row
  5. parent owns the space between

basics

~20 s

Inset is the space inside a container around its content, stack is the vertical space between stacked elements, and inline is the horizontal space between items in a row. Naming the roles makes intent explicit and clarifies who owns each space.

solid answer

~40 s

**Inset** is the space between a container's edge and its content, such as inside a restaurant card; it comes in equal, **squish** (less vertical, for buttons and chips) and **stretch** (more vertical, for list rows and fields) variants. **Stack** is the vertical space between elements placed one above another: a dish's name, description and price. **Inline** is the horizontal space between items in a row: an icon and its label, or a row of filter chips. All three draw from the **same spacing scale**; the roles add intent. That intent settles ownership: a component owns its inset, while the stack and inline space between components belongs to the parent layout, so as a rule components should not carry their own outer spacing, which doubles up or breaks when they are reused elsewhere.

go deeper

for a junior

Recall the three roles: inset inside a container, stack between items above one another, inline between items side by side.

for a middle

Explain squish and stretch insets, and why the parent rather than the child owns the space between components.

for a senior

Show how you would untangle a component library whose components carry outer spacing, and move that space into layout primitives.

for a principal

Discuss which roles a system should standardise and how far to let product teams add roles before the vocabulary stops being shared.

## Three roles, one scale A spacing scale says **which values** exist. Spacing roles say **what a value is for**. The three most widely used roles are: | Role | Direction | Where it sits | Food-delivery example | |---|---|---|---| | **Inset** | all sides | between a container's edge and its content | inside a restaurant card, around the photo and text | | **Stack** | vertical | between elements placed one above another | between a dish's name, description and price | | **Inline** | horizontal | between items placed side by side | between a star icon and the rating, or between filter chips | All three draw from the same scale. The roles do not introduce new numbers; they attach meaning to the existing ones. ## Inset variants Inset is often defined in three shapes: - **Equal inset**: the same space on every side, typical for cards and panels. - **Squish inset**: less space top and bottom than left and right, typical for buttons, chips and tags, which are wide and short. - **Stretch inset**: more space top and bottom than left and right, typical for list rows and text fields that need vertical breathing room. Defining the variants once stops every component from inventing its own ratio. ## Why separate roles help 1. **Intent is visible.** A spec that says "inset 16, stack 8" tells an engineer exactly where each value goes; a spec that says "16 and 8" does not. 2. **Ownership is clear.** A component owns its **inset**. The **stack** and **inline** space between components belongs to whatever places them: the list, the page section, the toolbar. 3. **Reuse works.** A card with no outer spacing of its own can be dropped into a list, a grid or a carousel and the parent decides how far apart the cards sit. A card that brings its own outer spacing doubles up next to a sibling, and has to be overridden in every new context. 4. **Rescaling can target roles.** A system can tighten stack spacing in a dense screen without touching insets, or the reverse, because the roles are separate. 5. **Review is easier.** A reviewer checks that the right role was used, not only that the number is on the scale. ## The ownership rule in practice In a **food-delivery app**, the restaurant list shows cards one above another: - The **card** owns its inset: 16 around its photo, name and delivery time. - **Inside the card**, stack spacing separates the name from the delivery time, and inline spacing separates the rating icon from the number. - **Between cards**, the list applies stack spacing of 16. The card itself adds nothing outside its own edge. If the card carried its own space below it, the last card in the list would leave an unwanted gap before the footer, and placing the same card in a horizontal carousel would leave space on the wrong side. ## Where the model is a guideline, not a law - Some components legitimately need a fixed relationship with a neighbour, such as a form field's helper text; that belongs **inside** the component as stack spacing, not outside it. - Some systems add further roles, such as a separate role for section spacing on a page. That is a refinement of the same idea. - Page margins and column gutters are layout-grid concerns rather than component spacing roles, even though their values often come from the same scale. ## How the roles appear in a system - The spacing documentation lists each role with its allowed steps, such as insets 8 to 24 and section stacks 32 to 64. - Component specs name the role next to every value. - Layout primitives in the component library, such as a stack and an inline row, apply the space between their children so that product teams rarely set it by hand. - Reviews check the role as well as the value: an inset used where a stack belongs is a defect even when the number is on the scale, because it will behave wrongly when the component is reused or when a denser mode rescales one role and not the other.

  • Why should a component not set its own outer spacing?
    Because the right distance to a neighbour depends on where the component is placed, which the component cannot know. Outer spacing doubles up next to a sibling that also has it, leaves stray space at the end of a list, and has to be overridden in every new context. Letting the parent own the space between children keeps components reusable.
  • What are squish and stretch insets for?
    They encode common shapes. Squish uses less vertical than horizontal space and suits wide, short elements such as buttons, chips and tags. Stretch uses more vertical than horizontal space and suits list rows and text fields that need vertical room. Defining them once keeps every component from inventing its own ratio.

saying these in an interview costs you the question

  • Inset, stack and inline are separate scales with unrelated values.
  • Components should include outer spacing so they look right anywhere.
  • Stack spacing is the horizontal space between items in a row.
  • Roles are redundant once every value is on the scale.