Skip to content

Dialog: Support custom width values#7831

Merged
liuliu-dev merged 7 commits into
mainfrom
liuliu/dialog-custom-width
May 14, 2026
Merged

Dialog: Support custom width values#7831
liuliu-dev merged 7 commits into
mainfrom
liuliu/dialog-custom-width

Conversation

@liuliu-dev
Copy link
Copy Markdown
Contributor

@liuliu-dev liuliu-dev commented May 11, 2026

Closes https://github.com/github/core-ux/issues/2489

Changelog

The Dialog width prop currently only accepts named sizes (small, medium, large, xlarge). This forces consumers who need non-standard widths to use !important CSS overrides .

This PR extends the width prop to also accept any valid CSS width value (string or number).

Before:

// Only named sizes allowed
<Dialog width="small" className="myDialog" />

// Consumers forced to use !important
.myDialog { width: 400px !important; }

After:

// Custom values now supported
<Dialog width="400px" />
<Dialog width="80rem" />

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

🦋 Changeset detected

Latest commit: af7ff49

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@primer
Copy link
Copy Markdown
Contributor

primer Bot commented May 11, 2026

🤖 Lint issues have been automatically fixed and committed to this PR.

@github-actions github-actions Bot temporarily deployed to storybook-preview-7831 May 11, 2026 20:21 Inactive
@liuliu-dev liuliu-dev added Canary Release Apply this label when you want CI to create a canary release of the current PR labels May 11, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7831 May 11, 2026 20:57 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7831 May 11, 2026 21:14 Inactive
@liuliu-dev liuliu-dev marked this pull request as ready for review May 11, 2026 21:16
@liuliu-dev liuliu-dev requested a review from a team as a code owner May 11, 2026 21:16
@liuliu-dev liuliu-dev requested review from TylerJDev and Copilot May 11, 2026 21:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends @primer/react’s Dialog width prop beyond the existing named sizes so consumers can provide custom CSS width values without relying on !important overrides.

Changes:

  • Updated DialogWidth typing and runtime behavior to support custom widths via a --dialog-width CSS custom property.
  • Updated Dialog styles to use width: var(--dialog-width, 640px) as the baseline.
  • Added tests, Storybook control updates, a new feature story, docs updates, and a minor changeset.
Show a summary per file
File Description
packages/react/src/Dialog/Dialog.tsx Expands width typing and sets data-width only for named sizes; injects --dialog-width for custom widths.
packages/react/src/Dialog/Dialog.module.css Switches default width to a CSS variable with a fallback, enabling custom width injection.
packages/react/src/Dialog/Dialog.test.tsx Adds coverage for named-size data-width behavior and custom-string width via --dialog-width.
packages/react/src/Dialog/Dialog.stories.tsx Updates Storybook control for width to text and describes custom width usage.
packages/react/src/Dialog/Dialog.features.stories.tsx Adds a “CustomWidth” feature story demonstrating a custom width value.
packages/react/src/Dialog/Dialog.docs.json Updates generated prop docs to reflect custom width support.
.changeset/tall-impalas-wash.md Declares a minor release for the new Dialog width capability.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 3

Comment thread packages/react/src/Dialog/Dialog.tsx Outdated
Comment thread packages/react/src/Dialog/Dialog.docs.json Outdated
Comment thread packages/react/src/Dialog/Dialog.test.tsx
liuliu-dev and others added 2 commits May 11, 2026 14:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions Bot requested a deployment to storybook-preview-7831 May 11, 2026 21:27 Abandoned
@github-actions github-actions Bot temporarily deployed to storybook-preview-7831 May 11, 2026 21:38 Inactive
@primer-integration
Copy link
Copy Markdown

Integration test results from github/github-ui:

Passed  CI   Passed
Passed  VRT   Passed
Passed  Projects   Passed

All checks passed!

Copy link
Copy Markdown
Contributor

@llastflowers llastflowers left a comment

Choose a reason for hiding this comment

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

Nice! ✨

@primer-integration
Copy link
Copy Markdown

⚠️ Hi from github/github-ui! The integration workflow could not find a canary version for the latest commit on this PR.

A successful canary CI run (i.e., a valid canary version published via the release.yml workflow) must exist for the latest commit before integration checks will succeed.

Next steps:

  1. Make sure the Canary Release label is applied to the PR — the release.yml workflow requires this label to publish a canary version.
  2. Wait for the release.yml canary CI run to complete successfully for the latest commit on this PR.
  3. Once a valid canary version exists, re-trigger the integration workflow by visiting the primer-react-pr-test workflow page, clicking Run workflow, and pasting this PR's URL.

For more details, see this workflow run.

@liuliu-dev liuliu-dev added integration-tests: skipped manually Changes in this PR do not require an integration test and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels May 14, 2026
@liuliu-dev
Copy link
Copy Markdown
Contributor Author

integration tests are passed but PR status not updated, skip manually.

@liuliu-dev liuliu-dev added this pull request to the merge queue May 14, 2026
Merged via the queue into main with commit 0de97c2 May 14, 2026
61 of 62 checks passed
@liuliu-dev liuliu-dev deleted the liuliu/dialog-custom-width branch May 14, 2026 20:03
@primer primer Bot mentioned this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: skipped manually Changes in this PR do not require an integration test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants