Skip to content

feat(core): BottomSheet publishes container padding, like Dialog - #6883

Merged
imdreamrunner merged 1 commit into
mainfrom
feat/bottom-sheet-container
Oct 5, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
feat/bottom-sheet-container

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

User need

People building a mobile sheet want it to work like a Dialog. Today BottomSheet's content box has no padding and publishes no container inset, which causes three problems:

  • Callers pad sheet content themselves, in different ways: a lone <Section padding={4}>, a VStack padded with a raw token string, or private body styles.
  • A theme cannot set sheet content padding. Its padding on bottom-sheet lands on the panel instead.
  • Bleed children have nothing to compensate against. Examples are a full-bleed Divider, a Table, and a TabList strip.

Dialog already solves all three through container lowering. BottomSheet can do the same without changing the default every released sheet relies on.

Problem and solution fit

  • Primary: BottomSheet's content box runs container() exactly as Dialog's does. The inset comes from the padding prop, then the theme's bottom-sheet padding, and the box publishes the inset it applies. With neither set, the box stays unpadded:
    • The edge chains end at 0px.
    • The Layout inset chains have no fallback value, so a Layout nested in an unthemed sheet keeps its own default padding.
    • The panel keeps overlayPaddingReset, so page geometry still stops at the sheet.
  • Supporting:
    • Theming metadata (container: true, padding → expand: 'container') plus the registry entry, so theme padding lowers to --astryx-bottom-sheet-padding*.
    • Consumer docs: a padding prop row and an updated Content-area anatomy.
    • A ContainerPadding Storybook story.
  • Not included: no caller changes. Existing sheets keep their own insets, and none need to change.

Current specification

#6882 records this decision, and it must merge first:

  • architecture:container-padding lists BottomSheet as a container publisher with Dialog's projection: the padding prop, then the theme's padding on bottom-sheet, then no inset.
  • component:BottomSheet FR4 records the Content area's inset and precedence, and that the released default is preserved.

Public delta and caller burden

  • New prop: padding?: SpacingStep. It takes Dialog's spacing steps (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10) and works on standalone and switcher sheets.
  • Default: unchanged. With no prop and no theme padding, there is no inset.
  • Theme: components['bottom-sheet'].base.padding (and its longhands) now emits --astryx-bottom-sheet-padding* tokens that inset the content box. Before, it emitted raw padding on the panel. None of the bundled themes set this.
  • Composition: once a sheet has an inset, a lone Section child escapes it (as it does in Dialog), and a full-bleed Divider or Table reaches the sheet's edges.
// Unchanged: no prop, no theme padding, no inset
<BottomSheet isOpen={isOpen} onOpenChange={setIsOpen} label="Filters">
  <Section padding={4}>…</Section>
</BottomSheet>

// New: the sheet supplies the inset, like Dialog
<BottomSheet isOpen={isOpen} onOpenChange={setIsOpen} label="Filters" padding={4}>
  <VStack gap={4}>…</VStack>
</BottomSheet>

// New: a theme sets it for every sheet
defineTheme({components: {'bottom-sheet': {base: {padding: '16px'}}}});

Callers don't need to change anything.

Design and alternatives

The model is Dialog's container lowering, with no new mechanism. #6882 rejects keeping caller-owned padding, and rejects defaulting to --spacing-4, which would double-pad released sheets and need a breaking change and a codemod.

Evidence

Real Chromium at 390×844 (2×). I built Storybook from main and from this branch, opened each sheet, and compared the panels.

Story Differing pixels Content box: padding / published inset / Layout inset
BottomSheet / Text only, Text only fitting, Showcase, Hug height, No scrim 0 each 0px / 0px / unset, same as main
Dialog / Mobile presentation / BottomSheet 0 / 581,880 same as main
DropdownMenu / action sheet, sectioned action sheet 0 each same as main
Popover / bottom sheet presentation option 0 / 555,360 same as main
Layer dismissal / sheet with hover tip 0 / 313,560 same as main

New behavior:

  • padding={4} (ContainerPadding story): text sits 16px in, the box publishes 16px, and a full-bleed Divider spans the full 388px inner width.
  • Theme tokens for padding: '24px 20px', injected on an existing story: the content box pads 24px/20px and publishes 20px inline. The Layout insets read 20px/24px, the panel stays unpadded, and a lone Section escapes to the full width.
ContainerPadding story (padding={4})
container padding

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • New tests:
    • BottomSheetPanel.test.tsx: the default chain publishes no inset, and its Layout insets have no fallback; explicit 0 and 2 are applied and published on all four edges; the panel stays unpadded.
    • BottomSheet.test.tsx: the prop reaches the content box in standalone and switcher sheets.
    • defineTheme.test.ts: bottom-sheet padding expands to container tokens.
    • derivedVarRegistry.test.ts: registry matches the docs.
  • vitest run on BottomSheet, theme, Layout, Dialog, Section, DropdownMenu, Date/Time/DateTime inputs, MobileTokenizer, and codemods: 3,493 tests pass.
  • pnpm check:repo, tsc for core and core docs, ESLint, Prettier, and codemod-verify (nothing to verify).
  • Storybook build, plus the before/after Chromium comparison above.

@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 4, 2026 8:27pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 2, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 2, 2026
@astracat-bot

astracat-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 4, 2026, 8:33 PM UTC

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

14 of 420 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858

Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@imdreamrunner imdreamrunner changed the title feat(core)!: BottomSheet is a padded container, like Dialog feat(core): BottomSheet publishes container padding, like Dialog Oct 2, 2026
@imdreamrunner
imdreamrunner marked this pull request as ready for review October 2, 2026 03:36

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making BottomSheet work like Dialog here — the preserved default, the published inset for Section and bleed children, and the focused tests and browser comparison all read clearly.

Approval needs a maintainer spec decision first. As it stands, the governing container-padding record lists Card, Section, Dialog, and ScrollableArea as container publishers and does not admit BottomSheet, and the BottomSheet record is still a draft with no padding claim. What must be settled is BottomSheet's padding prop, the theme padding projection on bottom-sheet, and the released unpadded default. The pending spec proposal that admits BottomSheet as a container publisher is the natural place: once a maintainer approves and merges that admission (or points to a current claim that already settles those three points), this implementation can be re-reviewed without a code change on spec grounds alone. No code defect was found in this pass.

[Automated review]

@kentonquatman kentonquatman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from the design side 👍

BottomSheet's content box resolves padding through container() the way
Dialog's does: the padding prop, then the theme's padding on
bottom-sheet (--astryx-bottom-sheet-padding*). With neither it keeps
the released unpadded default: the edge chains end at 0px and the
Layout inset chains have no terminal value, so a nested Layout keeps its
own default. The padded box publishes its inset, so a lone Section
child and bleed children such as Table and Divider align against it.
The panel stays the overlay boundary that resets inherited page
geometry.

- theming: container: true and padding -> expand: 'container', so a
  theme's padding on bottom-sheet lowers to container tokens instead of
  padding the panel.
- Storybook: ContainerPadding story (padding={4}, direct content,
  full-bleed Divider).
@imdreamrunner
imdreamrunner force-pushed the feat/bottom-sheet-container branch from 2ce03f4 to c740fad Compare October 4, 2026 20:20
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Oct 4, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making BottomSheet work like Dialog here. This reads ready to approve: the current container-padding spec now admits BottomSheet as a container publisher with the prop, then theme, then no-inset precedence this implements, and the preserved unpadded default checks out — the default sheet is unchanged against main in the browser comparison, while padding={4} applies and publishes a 16px inset that a full-bleed Divider escapes, with no accessibility violations. The focused BottomSheet, theme, Layout, Dialog, and Section tests also pass.

One note for theme authors, already in the docs and changeset: a theme's padding on bottom-sheet now insets the sheet content through container tokens instead of padding the panel, so any custom theme setting it should check the result. No code change is being requested.

[Automated review]

@imdreamrunner
imdreamrunner merged commit 031021b into main Oct 5, 2026
45 checks passed
@github-actions
github-actions Bot deleted the feat/bottom-sheet-container branch October 6, 2026 06:25
imdreamrunner added a commit that referenced this pull request Oct 6, 2026
The scrolling content area becomes a container publisher, mirroring the
BottomSheet container design (#6883): a padding prop on Dialog's
spacing-step scale, theme padding on 'drawer' expanded to
--astryx-drawer-padding* container tokens, and the released full-bleed
default preserved — edge chains terminate at 0px and Layout inset chains
have no terminal value, so an unthemed drawer is pixel-identical to
before. The block-end edge adds the home-indicator safe area on top of
the container inset in every mode, and the content area now paints the
surface so a dark-mode inset ring in --shadow-high no longer changes the
panel edge partway down (the #5305 treatment).

A lone Section child escapes the inset, bleed children such as an
isFullBleed Divider compensate against it, and a Layout inside picks it
up for its header, content, and footer regions — verified in Chromium
against the built Storybook, light and dark, including inset parity with
the same Layout composition inside a Dialog.

Core gains the drawer chains in container.stylex.ts, a drawer entry in
derivedVarRegistry (doc source of truth lives in packages/lab), and
Layout re-exports of the explicit-padding lowering maps that lab needs.
Drawer.spec.md records the candidate contract (FR16/DEC-2, pending owner
approval) and the open questions: the default inset, loose DrawerHeader
compensation, and explicit-padding safe-area semantics.

This branch was successfully deployed

1 active deployment
Preview — c740fad9 Deployed Oct 4, 2026 by vercel[bot]
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.

2 participants