Skip to content

fix(docsite): give ChatComposerInput block examples a definite width#4012

Open
ernestt wants to merge 1 commit into
mainfrom
fix/chat-composer-input-block-width
Open

fix(docsite): give ChatComposerInput block examples a definite width#4012
ernestt wants to merge 1 commit into
mainfrom
fix/chat-composer-input-block-width

Conversation

@ernestt

@ernestt ernestt commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

On the ChatComposerInput component page, the block examples render noticeably squished — the composer collapses to a narrow column instead of the intended ~450px, unlike the neighboring ChatComposer examples.

Root cause

The docsite preview (ExampleBlockLivePreview) centers each block in a flex row whose inner wrapper is min-width: fit-content. A child styled width: 100% has no definite width to resolve against inside a shrink-wrapping parent, so it collapses to the block's max-content width, and the maxWidth: 450 cap never engages.

For the bare ChatComposerInput examples, the intrinsic content is just an empty contentEditable (its placeholder is position: absolute, so it doesn't contribute width) plus the send button — so max-content is tiny and the composer renders squished. The ChatComposer examples that carry wider content (footer text, labeled buttons) happen to push max-content out to ~450, which is why they look fine.

Fix

Swap width: '100%', maxWidth: 450 for width: 450, maxWidth: '100%' on the six ChatComposerInput block wrappers. A definite width is honored by the fit-content preview wrapper, while maxWidth: 100% keeps the block responsive on narrow viewports.

Files:

  • ChatComposerInputShowcase.tsx
  • ChatComposerInputControlledInput.tsx
  • ChatComposerInputDisabled.tsx
  • ChatComposerInputMentionTrigger.tsx
  • ChatComposerInputMultipleTriggers.tsx
  • ChatComposerInputSlashCommands.tsx

No component/API changes — demo blocks only.

The block examples render inside the docsite's centered preview, whose
inner wrapper sizes to fit-content. A child styled width:100% has no
definite width to resolve against there, so it collapses to the block's
max-content width. For the bare ChatComposerInput examples that content
is just an empty contentEditable plus the send button, so the composer
rendered visibly squished instead of at its intended 450px.

Swap width:100%/maxWidth:450 for width:450/maxWidth:100% so the preview
wrapper honors a concrete 450px while the block still shrinks below that
on narrow viewports.
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 15, 2026 5:36pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 15, 2026
github-actions Bot added a commit that referenced this pull request Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.6KB 0B

Accessibility Audit

Status: No accessibility violations detected.


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

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