-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Navigation | ||
|
||
Navigation is a component which renders a component which renders a heirarchy of menu items. | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { MenuItem } from '@wordpress/components'; | ||
import { withState } from '@wordpress/compose'; | ||
|
||
const data = [ | ||
{ title: 'My Navigation', slug: 'root', back: 'Back' }, | ||
{ title: 'Home', slug: 'home', parent: 'root', menu: 'primary' }, | ||
{ title: 'Option one', slug: 'option_one', parent: 'root', menu: 'primary' }, | ||
{ title: 'Option two', slug: 'option_two', parent: 'root', menu: 'primary' }, | ||
{ title: 'Option three', slug: 'option_three', parent: 'root', menu: 'secondary' }, | ||
{ title: 'Child one', slug: 'child_one', parent: 'option_three', menu: 'primary' }, | ||
{ title: 'Child two', slug: 'child_two', parent: 'option_three', menu: 'primary' }, | ||
{ title: 'Child three', slug: 'child_three', parent: 'option_three', menu: 'primary' }, | ||
]; | ||
|
||
const MyNavigation = () => { | ||
return <Navigation data={ data } initial="home" />; | ||
}; | ||
``` | ||
|
||
## Props | ||
|
||
Navigation supports the following props. | ||
|
||
### `data` | ||
|
||
- Type: `array` | ||
- Required: Yes | ||
|
||
An array of config objects for each menu item. | ||
|
||
### `initial` | ||
|
||
- Type: `string` | ||
- Required: Yes | ||
|
||
The active slug. |