Skip to content

feat(modal): add "full" size option - #524

Merged
ddecrulle merged 1 commit into
codegouvfr:mainfrom
ubf-hunter:feat/modal-full-size
Nov 20, 2026
Merged

ddecrulle merged 1 commit into
codegouvfr:mainfrom
ubf-hunter:feat/modal-full-size

Conversation

@ubf-hunter

Copy link
Copy Markdown
Contributor

Closes #513

What

Adds a "full" value to Modal's size prop, alongside the existing "small" | "medium" | "large", mapped to fr-col-12 fr-col-md-12 fr-col-lg-12.

Why

As raised in #513, the modal width is currently capped at three fixed sizes. Nothing in the DSFR prevents a fr-col-lg-12 modal, and there are legitimate use cases (e.g. previewing a document before upload, with extra context fields) where a full-width modal is the right call.

Changes

  • src/Modal/Modal.tsx: add "full" to the size union type and its corresponding case in the width switch.
  • stories/Modal.stories.tsx: add "full" to the Storybook size control options (kept in sync with the type via the existing assert<Equals<...>> check).

This is purely additive — default ("medium") and existing sizes are untouched.

The modal width was capped at three fixed sizes (small/medium/large),
with no option to use the full available page width. Nothing in the
DSFR itself prevents a fr-col-lg-12 modal, and there are legitimate
use cases (e.g. previewing a document before upload) where a
full-width modal makes sense.

Add a "full" value to the size prop, mapped to
fr-col-12 fr-col-md-12 fr-col-lg-12, alongside the existing sizes.

Closes codegouvfr#513
@ddecrulle

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! The code looks good to me, but react-dsfr aims to be a React implementation of the DSFR design system, and as far as I know, this option is not supported by the DSFR itself. Am I missing something?

@pierrelemee

Copy link
Copy Markdown
Contributor

Thanks for the contribution! The code looks good to me, but react-dsfr aims to be a React implementation of the DSFR design system, and as far as I know, this option is not supported by the DSFR itself. Am I missing something?

Hello @ddecrulle no you're right, the DSFR doesn't offer this option. But it also doesn't forbid you to do so. Although I can customize the HTML in the DSFR, here in React I have to rewrite a whole new component and with it a new createModal hook, forcing me to stay a step apart from the original library.

My guess is that it conflicts with some UX rule stating that modals shouldn't be too wide and I respect that. Maybe a drawer component would be my best fit, but while waiting, I was hoping to tolerate this behaviour here.

What do you think ?

@ddecrulle

Copy link
Copy Markdown
Collaborator

There is another solution using patch-package, but of course, merging it directly into the codebase is the easiest approach.
Let's merge this, and if any concerns are raised, we can always revert it.
Thanks for the contribution! I'll release a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permettre d'afficher la modale en grand

3 participants