Skip to content

docs(layout): add padding/scroll hints to slot components - #200

Merged
cixzhang merged 1 commit into
mainfrom
navi/docs/layout-padding-hints
Feb 20, 2026
Merged

cixzhang merged 1 commit into
mainfrom
navi/docs/layout-padding-hints

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

What

Adds explicit hints to layout slot component JSDoc that they provide their own padding and scroll — don't add your own.

Why

From theme builder v2 exercise — the LLM added paddingInline, paddingBlock, and overflowY: 'auto' to components inside XDSLayoutPanel and XDSLayoutContent, causing double padding and nested scrollbars. The existing docs describe the padding system but don't say "you don't need to add padding to children."

Changes

JSDoc on each slot component:

  • XDSLayoutContent: "Already provides its own padding and scroll — don't add padding or overflow to children"
  • XDSLayoutPanel: same
  • XDSLayoutHeader: "Already provides its own padding — don't add padding to children"
  • XDSLayoutFooter: same

README: New "Padding and Scroll" section with ✅/❌ code examples.


Crafted with care by Navi

LLMs (and humans) don't realize layout slot components provide their
own padding and scroll containment, leading to doubled padding and
nested scrollbars when children add their own.

Added to each slot component's JSDoc:
- "Already provides its own padding and scroll — don't add padding
  or overflow to children"
- Points to isFullBleed for edge-to-edge content

Added "Padding and Scroll" section to README with ✅/❌ examples.

Motivated by theme builder v2 — the LLM added paddingInline,
paddingBlock, and overflowY to components inside XDSLayoutPanel
and XDSLayoutContent, causing double padding and double scrollbars.

Co-authored-by: Navi <[email protected]>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

Modified Components

Layout
Metric Before After Delta
Bundle Size (ESM) N/A 585B N/A
Lines of Code N/A 46 -
Complexity N/A Low (1) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 6.2KB 10.2KB 1.6KB

Accessibility Audit

Status: 13 accessibility violation(s) found.

XDSAspectRatio - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSCard - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSCenter - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSDivider - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSGrid - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSHStack - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSLayout - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSSection - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSStackItem - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSVStack - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name

Component Previews

Includes interactive hover previews as animated GIFs.

XDSAspectRatio

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--default

Widescreen 16 X 9

Screenshot:

Widescreen 16 X 9

Interaction Preview: (view video)

Widescreen 16 X 9 interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--widescreen-16-x-9

Classic 4 X 3

Screenshot:

Classic 4 X 3

Interaction Preview: (view video)

Classic 4 X 3 interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--classic-4-x-3

Square 1 X 1

Screenshot:

Square 1 X 1

Interaction Preview: (view video)

Square 1 X 1 interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--square-1-x-1

Ultrawide 21 X 9

Screenshot:

Ultrawide 21 X 9

Interaction Preview: (view video)

Ultrawide 21 X 9 interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--ultrawide-21-x-9

With Placeholder Skeleton

Screenshot:

With Placeholder Skeleton

Interaction Preview: (view video)

With Placeholder Skeleton interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--with-placeholder-skeleton

Responsive Grid

Screenshot:

Responsive Grid

Interaction Preview: (view video)

Responsive Grid interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--responsive-grid

All Ratios Comparison

Screenshot:

All Ratios Comparison

Interaction Preview: (view video)

All Ratios Comparison interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--all-ratios-comparison

Image Gallery

Screenshot:

Image Gallery

Interaction Preview: (view video)

Image Gallery interaction

Run yarn storybook and navigate to: layout-xdsaspectratio--image-gallery

XDSCard

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdscard--default

With Simple Content

Screenshot:

With Simple Content

Interaction Preview: (view video)

With Simple Content interaction

Run yarn storybook and navigate to: layout-xdscard--with-simple-content

With Inner Layout

Screenshot:

With Inner Layout

Interaction Preview: (view video)

With Inner Layout interaction

Run yarn storybook and navigate to: layout-xdscard--with-inner-layout

Sizes

Screenshot:

Sizes

Interaction Preview: (view video)

Sizes interaction

Run yarn storybook and navigate to: layout-xdscard--sizes

Fixed Height

Screenshot:

Fixed Height

Interaction Preview: (view video)

Fixed Height interaction

Run yarn storybook and navigate to: layout-xdscard--fixed-height

Nested Cards

Screenshot:

Nested Cards

Interaction Preview: (view video)

Nested Cards interaction

Run yarn storybook and navigate to: layout-xdscard--nested-cards

Nested Sections

Screenshot:

Nested Sections

Interaction Preview: (view video)

Nested Sections interaction

Run yarn storybook and navigate to: layout-xdscard--nested-sections

Single Section

Screenshot:

Single Section

Interaction Preview: (view video)

Single Section interaction

Run yarn storybook and navigate to: layout-xdscard--single-section

Mixed Content

Screenshot:

Mixed Content

Interaction Preview: (view video)

Mixed Content interaction

Run yarn storybook and navigate to: layout-xdscard--mixed-content

Full Bleed

Screenshot:

Full Bleed

Interaction Preview: (view video)

Full Bleed interaction

Run yarn storybook and navigate to: layout-xdscard--full-bleed

XDSCenter

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdscenter--default

Horizontal Only

Screenshot:

Horizontal Only

Interaction Preview: (view video)

Horizontal Only interaction

Run yarn storybook and navigate to: layout-xdscenter--horizontal-only

Vertical Only

Screenshot:

Vertical Only

Interaction Preview: (view video)

Vertical Only interaction

Run yarn storybook and navigate to: layout-xdscenter--vertical-only

Full Size

Screenshot:

Full Size

Interaction Preview: (view video)

Full Size interaction

Run yarn storybook and navigate to: layout-xdscenter--full-size

Inline

Screenshot:

Inline

Interaction Preview: (view video)

Inline interaction

Run yarn storybook and navigate to: layout-xdscenter--inline

With Icon

Screenshot:

With Icon

Interaction Preview: (view video)

With Icon interaction

Run yarn storybook and navigate to: layout-xdscenter--with-icon

Inside A Card

Screenshot:

Inside A Card

Interaction Preview: (view video)

Inside A Card interaction

Run yarn storybook and navigate to: layout-xdscenter--inside-a-card

All Axis Modes

Screenshot:

All Axis Modes

Interaction Preview: (view video)

All Axis Modes interaction

Run yarn storybook and navigate to: layout-xdscenter--all-axis-modes

XDSDivider

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdsdivider--default

With Label

Screenshot:

With Label

Interaction Preview: (view video)

With Label interaction

Run yarn storybook and navigate to: layout-xdsdivider--with-label

Variants

Screenshot:

Variants

Interaction Preview: (view video)

Variants interaction

Run yarn storybook and navigate to: layout-xdsdivider--variants

Full Bleed

Screenshot:

Full Bleed

Interaction Preview: (view video)

Full Bleed interaction

Run yarn storybook and navigate to: layout-xdsdivider--full-bleed

Vertical

Screenshot:

Vertical

Interaction Preview: (view video)

Vertical interaction

Run yarn storybook and navigate to: layout-xdsdivider--vertical

Vertical With Label

Screenshot:

Vertical With Label

Interaction Preview: (view video)

Vertical With Label interaction

Run yarn storybook and navigate to: layout-xdsdivider--vertical-with-label

In Card

Screenshot:

In Card

Interaction Preview: (view video)

In Card interaction

Run yarn storybook and navigate to: layout-xdsdivider--in-card

XDSGrid

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdsgrid--default

Fixed Columns

Screenshot:

Fixed Columns

Interaction Preview: (view video)

Fixed Columns interaction

Run yarn storybook and navigate to: layout-xdsgrid--fixed-columns

Responsive Auto Fit

Screenshot:

Responsive Auto Fit

Interaction Preview: (view video)

Responsive Auto Fit interaction

Run yarn storybook and navigate to: layout-xdsgrid--responsive-auto-fit

Capped Responsive

Screenshot:

Capped Responsive

Interaction Preview: (view video)

Capped Responsive interaction

Run yarn storybook and navigate to: layout-xdsgrid--capped-responsive

With Grid Span

Screenshot:

With Grid Span

Interaction Preview: (view video)

With Grid Span interaction

Run yarn storybook and navigate to: layout-xdsgrid--with-grid-span

Grid Span With Rows

Screenshot:

Grid Span With Rows

Interaction Preview: (view video)

Grid Span With Rows interaction

Run yarn storybook and navigate to: layout-xdsgrid--grid-span-with-rows

Gallery Example

Screenshot:

Gallery Example

Interaction Preview: (view video)

Gallery Example interaction

Run yarn storybook and navigate to: layout-xdsgrid--gallery-example

Different Gaps

Screenshot:

Different Gaps

Interaction Preview: (view video)

Different Gaps interaction

Run yarn storybook and navigate to: layout-xdsgrid--different-gaps

Dashboard Layout

Screenshot:

Dashboard Layout

Interaction Preview: (view video)

Dashboard Layout interaction

Run yarn storybook and navigate to: layout-xdsgrid--dashboard-layout

XDSHStack

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdshstack--default

With Gap

Screenshot:

With Gap

Interaction Preview: (view video)

With Gap interaction

Run yarn storybook and navigate to: layout-xdshstack--with-gap

Vertical Align Center

Screenshot:

Vertical Align Center

Interaction Preview: (view video)

Vertical Align Center interaction

Run yarn storybook and navigate to: layout-xdshstack--vertical-align-center

Vertical Align Start

Screenshot:

Vertical Align Start

Interaction Preview: (view video)

Vertical Align Start interaction

Run yarn storybook and navigate to: layout-xdshstack--vertical-align-start

Vertical Align End

Screenshot:

Vertical Align End

Interaction Preview: (view video)

Vertical Align End interaction

Run yarn storybook and navigate to: layout-xdshstack--vertical-align-end

Wrapping

Screenshot:

Wrapping

Interaction Preview: (view video)

Wrapping interaction

Run yarn storybook and navigate to: layout-xdshstack--wrapping

All Alignments

Screenshot:

All Alignments

Interaction Preview: (view video)

All Alignments interaction

Run yarn storybook and navigate to: layout-xdshstack--all-alignments

XDSLayout

Playground

Screenshot:

Playground

Interaction Preview: (view video)

Playground interaction

Run yarn storybook and navigate to: layout-xdslayout--playground

Basic Card Layout

Screenshot:

Basic Card Layout

Interaction Preview: (view video)

Basic Card Layout interaction

Run yarn storybook and navigate to: layout-xdslayout--basic-card

Layout with Sidebar

Screenshot:

Layout with Sidebar

Interaction Preview: (view video)

Layout with Sidebar interaction

Run yarn storybook and navigate to: layout-xdslayout--with-sidebar

Dual Panel Layout

Screenshot:

Dual Panel Layout

Interaction Preview: (view video)

Dual Panel Layout interaction

Run yarn storybook and navigate to: layout-xdslayout--dual-panels

Without Dividers

Screenshot:

Without Dividers

Interaction Preview: (view video)

Without Dividers interaction

Run yarn storybook and navigate to: layout-xdslayout--no-dividers

Full Bleed Content

Screenshot:

Full Bleed Content

Interaction Preview: (view video)

Full Bleed Content interaction

Run yarn storybook and navigate to: layout-xdslayout--full-bleed-content

Section Variants

Screenshot:

Section Variants

Interaction Preview: (view video)

Section Variants interaction

Run yarn storybook and navigate to: layout-xdslayout--section-variants

Content Only

Screenshot:

Content Only

Interaction Preview: (view video)

Content Only interaction

Run yarn storybook and navigate to: layout-xdslayout--content-only

Themed Layout (Neutral vs Default)

Screenshot:

Themed Layout (Neutral vs Default)

Interaction Preview: (view video)

Themed Layout (Neutral vs Default) interaction

Run yarn storybook and navigate to: layout-xdslayout--themed-layout

Outer Padding Demonstration

Screenshot:

Outer Padding Demonstration

Interaction Preview: (view video)

Outer Padding Demonstration interaction

Run yarn storybook and navigate to: layout-xdslayout--outer-padding-demo

XDSSection

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdssection--default

Variants

Screenshot:

Variants

Interaction Preview: (view video)

Variants interaction

Run yarn storybook and navigate to: layout-xdssection--variants

With Simple Content

Screenshot:

With Simple Content

Interaction Preview: (view video)

With Simple Content interaction

Run yarn storybook and navigate to: layout-xdssection--with-simple-content

With Inner Layout

Screenshot:

With Inner Layout

Interaction Preview: (view video)

With Inner Layout interaction

Run yarn storybook and navigate to: layout-xdssection--with-inner-layout

Page Layout

Screenshot:

Page Layout

Interaction Preview: (view video)

Page Layout interaction

Run yarn storybook and navigate to: layout-xdssection--page-layout

Full Bleed

Screenshot:

Full Bleed

Interaction Preview: (view video)

Full Bleed interaction

Run yarn storybook and navigate to: layout-xdssection--full-bleed

XDSStackItem

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdsstackitem--default

Fill Size

Screenshot:

Fill Size

Interaction Preview: (view video)

Fill Size interaction

Run yarn storybook and navigate to: layout-xdsstackitem--fill-size

Equal Fill

Screenshot:

Equal Fill

Interaction Preview: (view video)

Equal Fill interaction

Run yarn storybook and navigate to: layout-xdsstackitem--equal-fill

Cross Align Self

Screenshot:

Cross Align Self

Interaction Preview: (view video)

Cross Align Self interaction

Run yarn storybook and navigate to: layout-xdsstackitem--cross-align-self

Polymorphic Element

Screenshot:

Polymorphic Element

Interaction Preview: (view video)

Polymorphic Element interaction

Run yarn storybook and navigate to: layout-xdsstackitem--polymorphic-element

Common Layout Pattern

Screenshot:

Common Layout Pattern

Interaction Preview: (view video)

Common Layout Pattern interaction

Run yarn storybook and navigate to: layout-xdsstackitem--common-layout-pattern

XDSVStack

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

Run yarn storybook and navigate to: layout-xdsvstack--default

With Gap

Screenshot:

With Gap

Interaction Preview: (view video)

With Gap interaction

Run yarn storybook and navigate to: layout-xdsvstack--with-gap

Horizontal Align Center

Screenshot:

Horizontal Align Center

Interaction Preview: (view video)

Horizontal Align Center interaction

Run yarn storybook and navigate to: layout-xdsvstack--horizontal-align-center

Horizontal Align Start

Screenshot:

Horizontal Align Start

Interaction Preview: (view video)

Horizontal Align Start interaction

Run yarn storybook and navigate to: layout-xdsvstack--horizontal-align-start

Horizontal Align End

Screenshot:

Horizontal Align End

Interaction Preview: (view video)

Horizontal Align End interaction

Run yarn storybook and navigate to: layout-xdsvstack--horizontal-align-end

Wrapping

Screenshot:

Wrapping

Interaction Preview: (view video)

Wrapping interaction

Run yarn storybook and navigate to: layout-xdsvstack--wrapping

All Alignments

Screenshot:

All Alignments

Interaction Preview: (view video)

All Alignments interaction

Run yarn storybook and navigate to: layout-xdsvstack--all-alignments


Generated by PR Enrichment workflow | Storybook | View full report

@cixzhang
cixzhang merged commit 3d0a2c3 into main Feb 20, 2026
5 checks passed
@cixzhang
cixzhang deleted the navi/docs/layout-padding-hints branch February 20, 2026 03:03
cixzhang added a commit that referenced this pull request Apr 26, 2026
LLMs (and humans) don't realize layout slot components provide their
own padding and scroll containment, leading to doubled padding and
nested scrollbars when children add their own.

Added to each slot component's JSDoc:
- "Already provides its own padding and scroll — don't add padding
  or overflow to children"
- Points to isFullBleed for edge-to-edge content

Added "Padding and Scroll" section to README with ✅/❌ examples.

Motivated by theme builder v2 — the LLM added paddingInline,
paddingBlock, and overflowY to components inside XDSLayoutPanel
and XDSLayoutContent, causing double padding and double scrollbars.

Co-authored-by: Navi <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
LLMs (and humans) don't realize layout slot components provide their
own padding and scroll containment, leading to doubled padding and
nested scrollbars when children add their own.

Added to each slot component's JSDoc:
- "Already provides its own padding and scroll — don't add padding
  or overflow to children"
- Points to isFullBleed for edge-to-edge content

Added "Padding and Scroll" section to README with ✅/❌ examples.

Motivated by theme builder v2 — the LLM added paddingInline,
paddingBlock, and overflowY to components inside XDSLayoutPanel
and XDSLayoutContent, causing double padding and double scrollbars.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant