0.0.3 • Published 2 years ago

@lampoint/mention v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Mention

Angular directive for mentioning users. It works with contenteditable elements. This is an open source project from Lampoint.

DEMO

Installation

npm install @lampoint/mention

Usage

Add MentionModule in app.module

import { MentionModule } from '@lampoint/mention';

@NgModule({
    imports: [ MentionModule ],
    ...
})

Basic example

  mentions = [
    { id: 'denis', name: 'Denis' },
    { id: 'john', name: 'John' },
    { id: 'maria', name: 'Maria' },
    { id: 'michelle', name: 'Michelle' },
    { id: 'sophia', name: 'Sophia' },
    { id: 'james', name: 'James' },
    { id: 'emma', name: 'Emma' },
    { id: 'dave', name: 'Dave' }];
<div contenteditable="true" [mention]="mentions"></div>

Config options and events example

<div contenteditable="true" [mention]="mentions" 
[mentionConfig]="{trigger: '#', direction: 'top'}"
(selectedMention)="selectedMention($event)"
(searchTerm)="searchTerm($event)"></div>

Custom item template example

<ng-template #itemTemplate let-item="item"> {{item.id}} {{item.name}}</ng-template>
<div contenteditable="true" [mention]="mentions" [itemTemplate]="itemTemplate"></div>

Config options

OptionDefaultDescription
trigger@Trigger char for displaying items list
directionbottomSet items list direction (bottom/top)

Output events

OutputDescription
@Output() selectedMention EventEmitterGet selected mention { id: string, name: string }
@Output() searchTerm EventEmitterGet term for async search { term: string }

License

MIT

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

3 years ago