1
1
# rc-mentions
2
- ---
3
-
4
- React Mentions
5
2
6
3
[ ![ NPM version] [ npm-image ]] [ npm-url ]
7
- [ ![ build status] [ travis-image ]] [ travis-url ]
8
4
[ ![ Test coverage] [ codecov-image ]] [ codecov-url ]
9
5
[ ![ Dependencies] ( https://img.shields.io/david/react-component/mentions.svg?style=flat-square )] ( https://david-dm.org/react-component/mentions )
10
6
[ ![ DevDependencies] ( https://img.shields.io/david/dev/react-component/mentions.svg?style=flat-square )] ( https://david-dm.org/react-component/mentions?type=dev )
11
7
[ ![ npm download] [ download-image ]] [ download-url ]
12
- [ ![ Storybook] ( https://gw.alipayobjects.com/mdn/ob_info/afts/img/A*CQXNTZfK1vwAAAAAAAAAAABjAQAAAQ/original )] ( https://github.com/react-component/mentions )
13
8
14
- [ Storybook ] : https://github.com/storybooks/press/blob/master/badges/storybook.svg
15
9
[ npm-image ] : http://img.shields.io/npm/v/rc-mentions.svg?style=flat-square
16
10
[ npm-url ] : http://npmjs.org/package/rc-mentions
17
- [ travis-image ] : https://img.shields.io/travis/react-component/mentions.svg?style=flat-square
18
- [ travis-url ] : https://travis-ci.org/react-component/mentions
19
11
[ codecov-image ] : https://img.shields.io/codecov/c/github/react-component/mentions.svg?style=flat-square
20
12
[ codecov-url ] : https://codecov.io/gh/react-component/mentions/branch/master
21
13
[ node-image ] : https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
@@ -29,12 +21,12 @@ React Mentions
29
21
30
22
## Feature
31
23
32
- * support ie9,ie9+,chrome,firefox,safari
24
+ - support ie9,ie9+,chrome,firefox,safari
33
25
34
26
### Keyboard
35
27
36
- * Open mentions (focus input || focus and click)
37
- * KeyDown/KeyUp/Enter to navigate menu
28
+ - Open mentions (focus input || focus and click)
29
+ - KeyDown/KeyUp/Enter to navigate menu
38
30
39
31
## install
40
32
@@ -45,6 +37,9 @@ React Mentions
45
37
### basic use
46
38
47
39
``` js
40
+ /**
41
+ * inline: true
42
+ */
48
43
import Mentions from ' rc-mentions' ;
49
44
50
45
const { Option } = Mentions;
@@ -63,37 +58,37 @@ React.render(<Demo />, container);
63
58
64
59
### Mentions props
65
60
66
- | name | description | type | default |
67
- | ----------| ----------------| ----------| --------------|
68
- | autoFocus | Auto get focus when component mounted | boolean | ` false ` |
69
- | defaultValue | Default value | string | - |
70
- | filterOption | Customize filter option logic | false \| (input: string, option: OptionProps) => boolean | - |
71
- | notFoundContent | Set mentions content when not match | ReactNode | 'Not Found' |
72
- | placement | Set popup placement | 'top' \| 'bottom' | 'bottom' |
73
- | direction | Set popup direction | 'ltr' \| 'rtl' | 'ltr' |
74
- | prefix | Set trigger prefix keyword | string \| string[ ] | '@' |
75
- | rows | Set row count | number | 1 |
76
- | split | Set split string before and after selected mention | string | ' ' |
77
- | validateSearch | Customize trigger search logic | (text: string, props: MentionsProps) => void | - |
78
- | value | Set value of mentions | string | - |
79
- | onChange | Trigger when value changed | (text: string) => void | - |
80
- | onKeyDown | Trigger when user hits a key | React.KeyboardEventHandler<HTMLTextAreaElement > | - |
81
- | onKeyUp | Trigger when user releases a key | React.KeyboardEventHandler<HTMLTextAreaElement > | - |
82
- | onSelect | Trigger when user select the option | (option: OptionProps, prefix: string) => void | - |
83
- | onSearch | Trigger when prefix hit | (text: string, prefix: string) => void | - |
84
- | onFocus | Trigger when mentions get focus | React.FocusEventHandler<HTMLTextAreaElement > | - |
85
- | onBlur | Trigger when mentions lose focus | React.FocusEventHandler<HTMLTextAreaElement > | - |
86
- | getPopupContainer | DOM Container for suggestions | () => HTMLElement | - |
87
- | autoSize | Textarea height autosize feature, can be set to ` true\|false ` or an object ` { minRows: 2, maxRows: 6 } ` | boolean \| object | - |
88
- | onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - |
89
- | onResize | The callback function that is triggered when textarea resize | function({ width, height }) | - |
61
+ | name | description | type | default |
62
+ | ----------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ----------- |
63
+ | autoFocus | Auto get focus when component mounted | ` boolean ` | ` false ` |
64
+ | defaultValue | Default value | ` string ` | - |
65
+ | filterOption | Customize filter option logic | ` false \| (input: string, option: OptionProps) => boolean ` | - |
66
+ | notFoundContent | Set mentions content when not match | ` ReactNode ` | 'Not Found' |
67
+ | placement | Set popup placement | ` 'top' \| 'bottom' ` | 'bottom' |
68
+ | direction | Set popup direction | ` 'ltr' \| 'rtl' ` | 'ltr' |
69
+ | prefix | Set trigger prefix keyword | ` string \| string[] ` | '@' |
70
+ | rows | Set row count | ` number ` | 1 |
71
+ | split | Set split string before and after selected mention | ` string ` | ' ' |
72
+ | validateSearch | Customize trigger search logic | ` (text: string, props: MentionsProps) => void ` | - |
73
+ | value | Set value of mentions | ` string ` | - |
74
+ | onChange | Trigger when value changed | ` (text: string) => void ` | - |
75
+ | onKeyDown | Trigger when user hits a key | ` React.KeyboardEventHandler<HTMLTextAreaElement> ` | - |
76
+ | onKeyUp | Trigger when user releases a key | ` React.KeyboardEventHandler<HTMLTextAreaElement> ` | - |
77
+ | onSelect | Trigger when user select the option | ` (option: OptionProps, prefix: string) => void ` | - |
78
+ | onSearch | Trigger when prefix hit | ` (text: string, prefix: string) => void ` | - |
79
+ | onFocus | Trigger when mentions get focus | ` React.FocusEventHandler<HTMLTextAreaElement> ` | - |
80
+ | onBlur | Trigger when mentions lose focus | ` React.FocusEventHandler<HTMLTextAreaElement> ` | - |
81
+ | getPopupContainer | DOM Container for suggestions | ` () => HTMLElement ` | - |
82
+ | autoSize | Textarea height autosize feature, can be set to ` true\|false ` or an object ` { minRows: 2, maxRows: 6 } ` | ` boolean \| object ` | - |
83
+ | onPressEnter | The callback function that is triggered when Enter key is pressed | ` function(e) ` | - |
84
+ | onResize | The callback function that is triggered when textarea resize | ` function({ width, height }) ` | - |
90
85
91
86
### Methods
92
87
93
- | name | description |
94
- | ----------| ----------------|
95
- | focus() | Component get focus |
96
- | blur() | Component lose focus |
88
+ | name | description |
89
+ | ------- | -------------------- |
90
+ | focus() | Component get focus |
91
+ | blur() | Component lose focus |
97
92
98
93
## Development
99
94
@@ -120,7 +115,6 @@ npm test
120
115
npm run coverage
121
116
```
122
117
123
-
124
118
## License
125
119
126
120
rc-mentions is released under the MIT license.
0 commit comments