Skip to content

Commit c78cbc5

Browse files
committed
Add documentation of arrow, offsetX, and offsetY props
1 parent 2ff369e commit c78cbc5

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# React-Menu
22

3-
> React menu components
3+
> A customisable, lightweight, and optimised React menu library with accessibility.
44
55
**[Live examples and documentation](https://szhsin.github.io/react-menu/)**
66

@@ -49,6 +49,8 @@ export default function Example() {
4949
}
5050
```
5151

52+
[More examples and documentation](https://szhsin.github.io/react-menu/)
53+
5254
## License
5355

5456
MIT Licensed. Copyright (c) 2020 Zheng Song.

example/src/data/documentation.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ const keepMountedProp = {
7474
</>
7575
};
7676

77-
const menuChildrenProp = {
78-
name: 'children',
79-
type: 'node',
80-
desc: <p>Can be <code>MenuDivider, MenuHeader, MenuItem, FocusableItem,
81-
MenuRadioGroup, SubMenu</code> or any of their combinations.</p>
82-
};
83-
8477
const onChangeProp = {
8578
name: 'onChange',
8679
type: 'function',
@@ -131,9 +124,35 @@ const styleProps = (target, modifiers, className, styles) => [
131124
}
132125
];
133126

127+
const commonMenuProps = [
128+
{
129+
name: 'arrow',
130+
type: 'boolean',
131+
desc: <p>Set <code>true</code> to display an arrow pointing to its anchor element.</p>
132+
},
133+
{
134+
name: 'offsetX',
135+
type: 'number',
136+
defaultVal: 0,
137+
desc: <p>Set the horizontal distance (in pixels) between menu and its anchor element. The value can be negative.</p>
138+
},
139+
{
140+
name: 'offsetY',
141+
type: 'number',
142+
defaultVal: 0,
143+
desc: <p>Set the vertical distance (in pixels) between menu and its anchor element. The value can be negative.</p>
144+
},
145+
{
146+
name: 'children',
147+
type: 'node',
148+
desc: <p>Can be <code>MenuDivider, MenuHeader, MenuItem, FocusableItem,
149+
MenuRadioGroup, SubMenu</code> or any of their combinations.</p>
150+
}
151+
];
152+
134153
const menuPropsBase = [
135154
...styleProps('menu', menuModifiers),
136-
menuChildrenProp,
155+
...commonMenuProps,
137156
{
138157
name: 'id',
139158
type: 'string | number',
@@ -333,8 +352,8 @@ const submenu = {
333352
rows: [
334353
...styleProps('submenu item', submenuModifiers),
335354
...styleProps('submenu', menuModifiers, 'menuClassName', 'menuStyles'),
355+
...commonMenuProps,
336356
keepMountedProp,
337-
menuChildrenProp,
338357
onChangeProp,
339358
{
340359
name: 'aria-label',

0 commit comments

Comments
 (0)