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

@liuliu-devliuliu-dev commented May 11, 2026

Copy link
Copy Markdown
Contributor

Closeshttps://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<Dialogwidth="small"className="myDialog"/>// Consumers forced to use !important.myDialog{ width: 400px!important;}

After:

// Custom values now supported<Dialogwidth="400px"/><Dialogwidth="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

changeset-botBot commented May 11, 2026

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactMinor

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-actionsgithub-actionsBot 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

primerBot commented May 11, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions
github-actionsBottemporarily deployed to storybook-preview-7831 May 11, 2026 20:21 Inactive
@liuliu-devliuliu-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-actionsBottemporarily deployed to storybook-preview-7831 May 11, 2026 20:57 Inactive
@github-actions
github-actionsBottemporarily 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 ownerMay 11, 2026 21:16

CopilotAI 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.

Pull request overview

Extends @primer/react’s Dialogwidth 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
FileDescription
packages/react/src/Dialog/Dialog.tsxExpands width typing and sets data-width only for named sizes; injects --dialog-width for custom widths.
packages/react/src/Dialog/Dialog.module.cssSwitches default width to a CSS variable with a fallback, enabling custom width injection.
packages/react/src/Dialog/Dialog.test.tsxAdds coverage for named-size data-width behavior and custom-string width via --dialog-width.
packages/react/src/Dialog/Dialog.stories.tsxUpdates Storybook control for width to text and describes custom width usage.
packages/react/src/Dialog/Dialog.features.stories.tsxAdds a “CustomWidth” feature story demonstrating a custom width value.
packages/react/src/Dialog/Dialog.docs.jsonUpdates generated prop docs to reflect custom width support.
.changeset/tall-impalas-wash.mdDeclares a minor release for the new Dialog width capability.

Copilot's findings

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

Comment threadpackages/react/src/Dialog/Dialog.tsx Outdated
Comment threadpackages/react/src/Dialog/Dialog.docs.json Outdated
Comment threadpackages/react/src/Dialog/Dialog.test.tsx
liuliu-devand 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-actionsBot requested a deployment to storybook-preview-7831 May 11, 2026 21:27 Abandoned
@github-actions
github-actionsBottemporarily 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!

@llastflowersllastflowers 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.

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-devliuliu-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
ContributorAuthor

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

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

Labels

Canary ReleaseApply this label when you want CI to create a canary release of the current PRintegration-tests: skipped manuallyChanges in this PR do not require an integration test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@liuliu-dev@llastflowers