diff --git a/docs/designers-developers/developers/slotfills/main-dashboard-button.md b/docs/designers-developers/developers/slotfills/main-dashboard-button.md index 3a10665f21ad8e..5003872264aa68 100644 --- a/docs/designers-developers/developers/slotfills/main-dashboard-button.md +++ b/docs/designers-developers/developers/slotfills/main-dashboard-button.md @@ -1,9 +1,12 @@ # MainDashboardButton -This slot allows replacing the default main dashboard button that's used for closing -the editor in fullscreen mode. +This slot allows replacing the default main dashboard button in the post editor +that's used for closing the editor in fullscreen mode. In the site editor this slot +refers to the "back to dashboard" button in the navigation sidebar. -## Example +## Examples + +Basic usage: ```js import { registerPlugin } from '@wordpress/plugins'; @@ -22,8 +25,8 @@ registerPlugin( 'main-dashboard-button-test', { } ); ``` -If your goal is just to replace the icon of the existing button, that can be achieved -in the following way: +If your goal is just to replace the icon of the existing button in +the post editor, that can be achieved in the following way: ```js import { registerPlugin } from '@wordpress/plugins'; @@ -46,3 +49,29 @@ registerPlugin( 'main-dashboard-button-icon-test', { render: MainDashboardButtonIconTest, } ); ``` + +Site editor example: + +```js +import { registerPlugin } from '@wordpress/plugins'; +import { + __experimentalMainDashboardButton as MainDashboardButton, +} from '@wordpress/interface'; +import { + __experimentalNavigationBackButton as NavigationBackButton, +} from '@wordpress/components'; + +const MainDashboardButtonIconTest = () => ( + + + +); + +registerPlugin( 'main-dashboard-button-icon-test', { + render: MainDashboardButtonIconTest, +} ); +``` \ No newline at end of file diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/templates-navigation.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/templates-navigation.js index fa725931493309..44dd8765be8554 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/templates-navigation.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/templates-navigation.js @@ -7,6 +7,7 @@ import { __experimentalNavigationItem as NavigationItem, __experimentalNavigationBackButton as NavigationBackButton, } from '@wordpress/components'; +import { __experimentalMainDashboardButton as MainDashboardButton } from '@wordpress/interface'; import { useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; @@ -50,11 +51,13 @@ export default function TemplatesNavigation() { onActivateMenu={ setNavigationPanelActiveMenu } > { activeMenu === MENU_ROOT && ( - + + + ) }