{"id":13422120,"url":"https://github.com/signavio/react-mentions","last_synced_at":"2025-12-12T04:34:04.344Z","repository":{"id":23536898,"uuid":"26903737","full_name":"signavio/react-mentions","owner":"signavio","description":"@mention people in a textarea","archived":false,"fork":false,"pushed_at":"2024-09-27T12:53:03.000Z","size":34650,"stargazers_count":2582,"open_issues_count":247,"forks_count":605,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-23T20:54:59.367Z","etag":null,"topics":["inline-styles","mentions","react","tags"],"latest_commit_sha":null,"homepage":"https://react-mentions.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/signavio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-20T08:51:31.000Z","updated_at":"2025-04-22T03:01:08.000Z","dependencies_parsed_at":"2022-07-12T16:07:37.796Z","dependency_job_id":"8603380f-d73a-40f5-a94d-9b0eb5ba5025","html_url":"https://github.com/signavio/react-mentions","commit_stats":{"total_commits":499,"total_committers":76,"mean_commits":6.565789473684211,"dds":0.6012024048096192,"last_synced_commit":"7e696512250a752ec4a303ef1b88c896f3028581"},"previous_names":["effektif/react-mentions"],"tags_count":90,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/signavio%2Freact-mentions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/signavio%2Freact-mentions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/signavio%2Freact-mentions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/signavio%2Freact-mentions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/signavio","download_url":"https://codeload.github.com/signavio/react-mentions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514767,"owners_count":21443208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inline-styles","mentions","react","tags"],"created_at":"2024-07-30T23:00:37.337Z","updated_at":"2025-12-12T04:33:59.320Z","avatar_url":"https://github.com/signavio.png","language":"JavaScript","funding_links":[],"categories":["UI Components","JavaScript"],"sub_categories":["Form Components"],"readme":"# [React Mentions](https://react-mentions.vercel.app)\n[![REUSE status](https://api.reuse.software/badge/github.com/signavio/react-mentions)](https://api.reuse.software/info/github.com/signavio/react-mentions)\n\nA React component that let's you mention people in a textarea like you are used to on Facebook or Twitter.\n\nUsed in production at [Signavio](https://signavio.com), [State](https://state.com), [Snips](https://snips.ai), [Swat.io](https://swat.io), [GotDone](https://www.gotdone.me), [Volinspire](https://volinspire.com), [Marvin](https://amazingmarvin.com), [Timely](https://timelyapp.com), [GuideFitter](https://www.guidefitter.com/), [Evite](https://www.evite.com/), [Publer](https://publer.me/), [Kontentino](https://www.kontentino.com/), [Wix.com](https://wix.com), [Highlight](https://highlight.run/) and [you?](https://github.com/signavio/react-mentions/edit/master/README.md)\n\n## Getting started\n\nInstall the _react-mentions_ package via npm:\n\n```\nnpm install react-mentions --save\n```\n\nOr yarn:\n\n```\nyarn add react-mentions\n```\n\nThe package exports two React components for rendering the mentions textarea:\n\n```javascript\nimport { MentionsInput, Mention } from 'react-mentions'\n```\n\n`MentionsInput` is the main component rendering the textarea control. It takes one or multiple `Mention` components as its children. Each `Mention` component represents a data source for a specific class of mentionable objects, such as users, template variables, issues, etc.\n\nExample:\n\n```jsx\n\u003cMentionsInput value={this.state.value} onChange={this.handleChange}\u003e\n  \u003cMention\n    trigger=\"@\"\n    data={this.props.users}\n    renderSuggestion={this.renderUserSuggestion}\n  /\u003e\n  \u003cMention\n    trigger=\"#\"\n    data={this.requestTag}\n    renderSuggestion={this.renderTagSuggestion}\n  /\u003e\n\u003c/MentionsInput\u003e\n```\n\nYou can find more examples here: [demo/src/examples](https://github.com/signavio/react-mentions/tree/master/demo/src/examples)\n\n## Configuration\n\nThe `MentionsInput` supports the following props for configuring the widget:\n\n| Prop name                   | Type                                                    | Default value  | Description                                                                            |\n| --------------------------- | ------------------------------------------------------- | -------------- | -------------------------------------------------------------------------------------- |\n| value                       | string                                                  | `''`           | The value containing markup for mentions                                               |\n| onChange                    | function (event, newValue, newPlainTextValue, mentions) | empty function | A callback that is invoked when the user changes the value in the mentions input       |\n| onKeyDown                   | function (event)                                        | empty function | A callback that is invoked when the user presses a key in the mentions input           |\n| singleLine                  | boolean                                                 | `false`        | Renders a single line text input instead of a textarea, if set to `true`               |\n| onBlur                      | function (event, clickedSuggestion)                     | empty function | Passes `true` as second argument if the blur was caused by a mousedown on a suggestion |\n| allowSpaceInQuery           | boolean                                                 | false          | Keep suggestions open even if the user separates keywords with spaces.                 |\n| suggestionsPortalHost       | DOM Element                                             | undefined      | Render suggestions into the DOM in the supplied host element.                          |\n| inputRef                    | React ref                                               | undefined      | Accepts a React ref to forward to the underlying input element                         |\n| allowSuggestionsAboveCursor | boolean                                                 | false          | Renders the SuggestionList above the cursor if there is not enough space below         |\n| forceSuggestionsAboveCursor | boolean                                                 | false          | Forces the SuggestionList to be rendered above the cursor                              |\n| a11ySuggestionsListLabel    | string                                                  | `''`           | This label would be exposed to screen readers when suggestion popup appears            |\n| customSuggestionsContainer  | function(children)                                      | empty function | Allows customizing the container of the suggestions                                    |\n| inputComponent              | React component                                         | undefined      | Allows the use of a custom input component component                                                 |\n\nEach data source is configured using a `Mention` component, which has the following props:\n\n| Prop name        | Type                                                         | Default value                               | Description                                                                                                                                            |\n| ---------------- | ------------------------------------------------------------ | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| trigger          | regexp or string                                             | `'@'`                                       | Defines the char sequence upon which to trigger querying the data source                                                                               |\n| data             | array or function (search, callback)                         | `null`                                      | An array of the mentionable data entries (objects with `id` \u0026 `display` keys, or a filtering function that returns an array based on a query parameter |\n| renderSuggestion | function (entry, search, highlightedDisplay, index, focused) | `null`                                      | Allows customizing how mention suggestions are rendered (optional)                                                                                     |\n| markup           | string                                                       | `'@[__display__](__id__)'`                  | A template string for the markup to use for mentions                                                                                                   |\n| displayTransform | function (id, display)                                       | returns `display`                           | Accepts a function for customizing the string that is displayed for a mention                                                                          |\n| regex            | RegExp                                                       | automatically derived from `markup` pattern | Allows providing a custom regular expression for parsing your markup and extracting the placeholder interpolations (optional)                          |  |\n| onAdd            | function (id, display, startPos, endPos)                     | empty function                              | Callback invoked when a suggestion has been added (optional)                                                                                           |\n| appendSpaceOnAdd | boolean                                                      | `false`                                     | Append a space when a suggestion has been added (optional)                                                                                             |\n\nIf a function is passed as the `data` prop, that function will be called with the current search query as first, and a callback function as second argument. The callback can be used to provide results asynchronously, e.g., after fetch requests. (It can even be called multiple times to update the list of suggestions.)\n\n## Styling\n\n_react-mentions_ supports css, css modules, and inline styles. It is shipped with only some essential inline style definitions and without any css. Some example inline styles demonstrating how to customize the appearance of the `MentionsInput` can be found at [demo/src/examples/defaultStyle.js](https://github.com/signavio/react-mentions/blob/master/demo/src/examples/defaultStyle.js).\n\nIf you want to use css, simply assign a `className` prop to `MentionsInput`. All DOM nodes rendered by the component will then receive class name attributes that are derived from the base class name you provided.\n\nIf you want to avoid global class names and use css modules instead, you can provide the automatically generated class names as `classNames` to the `MentionsInput`. See [demo/src/examples/CssModules.js](https://github.com/signavio/react-mentions/blob/master/demo/src/examples/CssModules.js) for an example of using _react-mentions_ with css modules.\n\nYou can also assign `className` and `style` props to the `Mention` elements to define how to highlight the mentioned words.\n\n## Testing\n\nDue to react-mentions' internal cursor tracking it is not good enough to simulate the editing of the textarea value using `ReactTestUtils.Simulate.change`.\nWe recommend using [@testing-library/user-event](https://github.com/testing-library/user-event) for a realistic simulation of events as they would happen in the browser as the user interacts the textarea.\n\n---\n\nIf you want to contribute, first of all: thank you ❤️.\nPlease check [CONTRIBUTING.md](/CONTRIBUTING.md) and/or create an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsignavio%2Freact-mentions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsignavio%2Freact-mentions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsignavio%2Freact-mentions/lists"}