feat(react-drawer): expose drawer base hooks#36042
Merged
Merged
Conversation
📊 Bundle size report
Unchanged fixtures
|
|
Pull request demo site: URL |
mainframev
approved these changes
Apr 28, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new public “base” hooks/types to @fluentui/react-drawer and refactors drawer sizing into a dedicated DrawerSizeProps type to improve extensibility and type safety.
Changes:
- Export new base APIs (
useDrawerBase_unstable,DrawerBase*types,DrawerSize*types,useDrawerHeaderTitleBase_unstable). - Refactor
sizehandling out ofDrawerBasePropsintoDrawerSizePropsand update internal typing accordingly. - Add unit tests validating size/defaulting behavior and state shape.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-components/react-drawer/library/src/shared/useDrawerDefaultProps.ts | Updates defaulting helper to use DrawerSizeProps for size. |
| packages/react-components/react-drawer/library/src/shared/useDrawerBaseStyles.styles.ts | Adjusts styling helper typing to require size via DrawerSizeProps. |
| packages/react-components/react-drawer/library/src/shared/useDrawerBase.ts | Introduces new base hook returning only behavior defaults. |
| packages/react-components/react-drawer/library/src/shared/useDrawerBase.test.ts | Adds tests for new base hook and updated defaulting behavior. |
| packages/react-components/react-drawer/library/src/shared/drawerMotions.ts | Refactors motion param types and duration map to use DrawerSizeProps. |
| packages/react-components/react-drawer/library/src/shared/DrawerSize.types.ts | Adds new shared DrawerSize/DrawerSizeProps types. |
| packages/react-components/react-drawer/library/src/shared/DrawerBase.types.ts | Removes size from DrawerBaseProps and introduces DrawerBaseDefaultedProps. |
| packages/react-components/react-drawer/library/src/index.ts | Exports new public hooks/types from the package entrypoint. |
| packages/react-components/react-drawer/library/src/components/OverlayDrawer/OverlayDrawer.types.ts | Updates OverlayDrawer props/state to include DrawerSizeProps. |
| packages/react-components/react-drawer/library/src/components/OverlayDrawer/OverlayDrawer.test.tsx | Adds test asserting size is preserved in hook state. |
| packages/react-components/react-drawer/library/src/components/InlineDrawer/useInlineDrawer.ts | Adds useInlineDrawerBase_unstable and updates imports/types. |
| packages/react-components/react-drawer/library/src/components/InlineDrawer/renderInlineDrawer.tsx | Changes rendering to conditionally wrap with surfaceMotion. |
| packages/react-components/react-drawer/library/src/components/InlineDrawer/InlineDrawer.types.ts | Adds base slots/state types and includes DrawerSizeProps in props/state. |
| packages/react-components/react-drawer/library/src/components/InlineDrawer/InlineDrawer.test.tsx | Adds test asserting size is preserved in hook state. |
| packages/react-components/react-drawer/library/src/components/DrawerHeaderTitle/useDrawerHeaderTitle.ts | Extracts a new useDrawerHeaderTitleBase_unstable hook. |
| packages/react-components/react-drawer/library/src/components/DrawerHeaderTitle/index.ts | Exports useDrawerHeaderTitleBase_unstable. |
| packages/react-components/react-drawer/library/src/DrawerHeaderTitle.ts | Re-exports the new base hook from the barrel. |
| packages/react-components/react-drawer/library/etc/react-drawer.api.md | Updates extracted public API to include new exports and refactored types. |
| change/@fluentui-react-drawer-2c8d4430-a744-43ff-8fd5-3e4b4f6c3a7a.json | Beachball change file for the new minor feature. |
f6cdf6d to
4ef41ed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request introduces a minor feature update to the
@fluentui/react-drawerpackage, focusing on improving extensibility and type safety by exporting new base hooks and types, and refactoring how drawer size is handled. The changes make it easier for consumers to access and use base drawer logic and types, and clarify the separation between base and size-related properties. Additional tests ensure that the new size handling works as expected.