Mention
Vue Bootstrap 5 Mention plugin
Responsive Mention plugin built with the latest Bootstrap 5 and Vue 3. Mention is an autocomplete dropdown menu for your search inputs. It is useful for tagging users or topics.
Note: Read the API tab to find all available options and advanced customization
Basic example
Type @ and use up/down arrows, home/end keys to navigate. Click enter or use mouse click to choose item
Data from HTML
Mention component can be reached without setup initialization.
In such case list items should have proper data-mdb-
attributes and list should
have mention-data-items
class.
Toggle show list on trigger
Showing all items on trigger key is turned on by default. Set
showListOnTrigger
prop to false
to turn it off and show items only
after user search input.
Placement example
Use placement
prop to change placement of the component
Position of the component will be flipped to opposite side when no free space is available. Once enough space is detected, component will flip back to its original placement
Textarea example
Mention works also with textarea
Customize search conditions
Use queryBy
prop to change search conditions
Customize no results text
Set noResultsText
to a text of your choice to change the message for no results
found.
Trigger sign
Use trigger
prop to change search triggering sign
Show image
Use showImage
prop to show images in the mentions list
Visible items
Use visibleItems
prop to change the number of options that will be displayed in
the select dropdown without scrolling.
Multiple lists
Assign multiple mentions to the element by wrapping an input by any number of Mention elements.
Asynchronous data
Mention - API
Import
Props
Prop | Type | Default | Description |
---|---|---|---|
items
|
Array |
|
Defines mention items. |
itemHeight
|
Number | 35 |
Defines mention item height. |
noItemsText
|
String | "" |
Defines no items text. |
noResultsText
|
String | "No results found" |
Defines no results text. |
placement
|
String | "bottom" |
Defines dropdown default position. |
queryBy
|
String | "name" |
Defines query rule. |
showImage
|
Boolean | false |
Enables images in dropdown. |
showListOnTrigger
|
Boolean | true |
Enables showing list right after trigger typing. |
tag
|
String | "div" |
Defines wrapper tag. |
trigger
|
String | "@" |
Defines default trigger. |
visibleItems
|
Number | 5 |
Defines max number of visible items in the list. |
Methods
Name | Description |
---|---|
open |
Manually opens a mention |
close |
Manually closes a mention |
Events
Name | Description |
---|---|
open
|
This event fires immediately when the mention is opened. |
close
|
This event fires immediately when the mention is closed. |
select
|
This event fires immediately when the list item is selected. I returns selected item queryBy value. |
change
|
This event fires immediately when the mention reference element value changes. |