rc-mentions
React Mentions
Last updated 5 years ago by zombiej .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install rc-mentions 
SYNC missed versions from official npm registry.

rc-mentions

NPM version npm download build status Codecov bundle size dumi

Screenshots

Feature

  • support ie9,ie9+,chrome,firefox,safari

Keyboard

  • Open mentions (focus input || focus and click)
  • KeyDown/KeyUp/Enter to navigate menu

install

rc-mentions

Usage

basic use

/**
 * inline: true
 */
import Mentions from 'rc-mentions';

const { Option } = Mentions;

var Demo = (
  <Mentions>
    <Option value="light">Light</Option>
    <Option value="bamboo">Bamboo</Option>
    <Option value="cat">Cat</Option>
  </Mentions>
);
React.render(<Demo />, container);

API

Mentions props

name description type default
autoFocus Auto get focus when component mounted boolean false
defaultValue Default value string -
filterOption Customize filter option logic false \| (input: string, option: OptionProps) => boolean -
notFoundContent Set mentions content when not match ReactNode 'Not Found'
placement Set popup placement 'top' \| 'bottom' 'bottom'
direction Set popup direction 'ltr' \| 'rtl' 'ltr'
prefix Set trigger prefix keyword string \| string[] '@'
rows Set row count number 1
split Set split string before and after selected mention string ' '
silent Used in transition phase, does not respond to keyboard enter events when equal to true boolean false
validateSearch Customize trigger search logic (text: string, props: MentionsProps) => void -
value Set value of mentions string -
onChange Trigger when value changed (text: string) => void -
onKeyDown Trigger when user hits a key React.KeyboardEventHandler<HTMLTextAreaElement> -
onKeyUp Trigger when user releases a key React.KeyboardEventHandler<HTMLTextAreaElement> -
onSelect Trigger when user select the option (option: OptionProps, prefix: string) => void -
onSearch Trigger when prefix hit (text: string, prefix: string) => void -
onFocus Trigger when mentions get focus React.FocusEventHandler<HTMLTextAreaElement> -
onBlur Trigger when mentions lose focus React.FocusEventHandler<HTMLTextAreaElement> -
getPopupContainer DOM Container for suggestions () => HTMLElement -
autoSize Textarea height autosize feature, can be set to true\|false or an object { minRows: 2, maxRows: 6 } boolean \| object -
onPressEnter The callback function that is triggered when Enter key is pressed function(e) -
onResize The callback function that is triggered when textarea resize function({ width, height }) -

Methods

name description
focus() Component get focus
blur() Component lose focus

Development

npm install
npm start

Example

http://localhost:9001/

online example: http://react-component.github.io/mentions/

Test Case

npm test

Coverage

npm run coverage

License

rc-mentions is released under the MIT license.

Current Tags

  • 0.2.0-alpha.5                                ...           beta (6 years ago)
  • 2.16.1                                ...           latest (3 months ago)

69 Versions

  • 2.16.1                                ...           3 months ago
  • 2.16.0                                ...           3 months ago
  • 2.15.0                                ...           4 months ago
  • 2.14.0                                ...           5 months ago
  • 2.13.2                                ...           5 months ago
  • 2.13.1                                ...           6 months ago
  • 2.13.0                                ...           6 months ago
  • 2.12.0                                ...           6 months ago
  • 2.11.1                                ...           8 months ago
  • 2.11.0                                ...           8 months ago
  • 2.10.1                                ...           a year ago
  • 2.10.0                                ...           a year ago
  • 2.9.1                                ...           a year ago
  • 2.9.0                                ...           a year ago
  • 2.8.0                                ...           a year ago
  • 2.7.0                                ...           a year ago
  • 2.6.0                                ...           a year ago
  • 2.5.0                                ...           a year ago
  • 2.4.1                                ...           a year ago
  • 2.4.0                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.0                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.13.1                                ...           2 years ago
  • 1.13.0                                ...           2 years ago
  • 1.12.0                                ...           2 years ago
  • 1.11.0                                ...           2 years ago
  • 1.10.0                                ...           2 years ago
  • 1.9.2                                ...           2 years ago
  • 1.9.1                                ...           2 years ago
  • 1.9.0                                ...           2 years ago
  • 1.8.0                                ...           3 years ago
  • 1.7.1                                ...           3 years ago
  • 1.7.0                                ...           3 years ago
  • 1.6.5                                ...           3 years ago
  • 1.6.4                                ...           3 years ago
  • 1.6.3                                ...           3 years ago
  • 1.6.2                                ...           3 years ago
  • 1.6.1                                ...           3 years ago
  • 1.6.0                                ...           4 years ago
  • 1.5.3                                ...           4 years ago
  • 1.5.2                                ...           4 years ago
  • 1.5.1                                ...           4 years ago
  • 1.5.0                                ...           4 years ago
  • 1.4.2                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 1.0.0-alpha.4                                ...           5 years ago
  • 0.4.2                                ...           5 years ago
  • 1.0.0-alpha.3                                ...           5 years ago
  • 1.0.0-alpha.0                                ...           5 years ago
  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.3                                ...           6 years ago
  • 0.2.2                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0-alpha.5                                ...           6 years ago
  • 0.2.0-alpha.3                                ...           6 years ago
  • 0.2.0-alpha.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (2)
Downloads
Total 3
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (14)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE