Hi @Paul Rowe
Thank you for posting your question in the Microsoft Q&A forum.
You can’t place a web part directly on the Modern library view page (…/Forms/AllItems.aspx). Modern library pages (default list/library view pages) are system pages; you cannot add regular SPFx web parts to them. Web parts only work on editable pages (modern site pages), not the built-in library view.
Supported alternatives:
1.SPFx Application Customizer
-You can inject your UI (buttons, modals, warnings) at the top of the page using the Top placeholder.
-Works on library pages themselves, so users stay in the library.
-Can read the current folder from RootFolder or id in the URL and handle logic like showing buttons per folder.
Note: On modern library pages, RootFolder may not always be present when navigating between folders without refreshing, so fallback detection may be required.
-Reference: Use page placeholders from Application Customizer (Hello World part 2) | Microsoft Learn.
2.ListView Command Set
-Adds item-level or row-level buttons directly to the library toolbar/context menu.
-Ideal if your buttons are per file/folder.
-Reference: Build your first ListView Command Set extension | Microsoft Learn.
The Document Library web part can be configured to open a specific folder, but this is controlled through a static setting in the web part’s properties. Once configured, the folder path remains fixed, and there is no supported query‑string parameter that allows the embedded web part to dynamically open a different folder at runtime.
However, modern library pages support direct deep links to folders. For example, you can navigate directly to a subfolder using a URL such as: /sites/SiteA/Shared Documents/Forms/AllItems.aspx?id=/sites/SiteA/Shared Documents/FolderA/SubfolderB. This approach works when users go directly to the library view page itself. It does not apply when the library is embedded as a web part on another modern page, since in that scenario the folder setting remains static and cannot be changed through the URL.
I hope this information is helpful.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.