Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update docs
  • Loading branch information
david-szabo97 committed Nov 12, 2020
commit c120d0da921a8c24489bc71b8c2a6a57b6015df1
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
Expand All @@ -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 = () => (
<MainDashboardButton>
<NavigationBackButton
backButtonLabel={ __( 'Back to dashboard' ) }
className="edit-site-navigation-panel__back-to-dashboard"
href="index.php"
/>
</MainDashboardButton>
);

registerPlugin( 'main-dashboard-button-icon-test', {
render: MainDashboardButtonIconTest,
} );
```