Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-mentions

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-mentions

React Mentions

  • 0.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-9.14%
Maintainers
1
Weekly downloads
 
Created

What is rc-mentions?

The rc-mentions npm package is designed to provide a React component for implementing mention features within applications. It allows users to easily mention people, tags, or other entities in text inputs or textareas by typing a trigger character (like '@') followed by a list of suggestions.

What are rc-mentions's main functionalities?

Basic Mentioning

This feature allows for basic mentioning functionality where users can type '@' followed by a list of predefined suggestions. The code sample demonstrates how to set up a basic Mention component with a default value and a list of suggestions.

import React from 'react';
import Mention from 'rc-mentions';
const { Option } = Mention;

function App() {
  return (
    <Mention
      style={{ width: '100%' }}
      defaultValue="@afc163"
      suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご']}
    />
  );
}

Custom Trigger

This feature allows users to customize the trigger character for mentions. In this example, both '@' and '#' are set as triggers, enabling mentions for users as well as tags or other entities.

import React from 'react';
import Mention from 'rc-mentions';
const { Option } = Mention;

function App() {
  return (
    <Mention
      style={{ width: '100%' }}
      prefix={['@', '#']}
      suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご']}
    />
  );
}

Custom Render

This feature allows for custom rendering of suggestions. The code sample shows how to use the Option component to customize how suggestions are displayed, providing more flexibility in the presentation of suggestions.

import React from 'react';
import Mention from 'rc-mentions';
const { Option } = Mention;

function App() {
  return (
    <Mention
      style={{ width: '100%' }}
      suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご'].map(value => (
        <Option key={value} value={value}>
          {value}
        </Option>
      ))}
    />
  );
}

Other packages similar to rc-mentions

Keywords

FAQs

Package last updated on 14 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc