Tags with continents autocomplete

Tags with Europe countries autocomplete

Default set + icon change

Tags only from source list ( Blocks adding other tags )

Component features

Some react-material-tags features:

Components properties

PropertyTypeDescription
defTagsarrayIt is list of tags which was chosen before, tipical usage is in edition when using this property We can set saved before tags. Example: [{label:"Poland"},{label:"USA"}]
sourceTagsarrayList of tags which will be available in autocomplete. If onlyFromSource property is on true then user can only choose tags from this list. Example: [{label:"Poland"},{label:"USA"}]
onlyFromSourceboolDefault: false. If true then user can only add tag from sourceTags.
onlyFromSourceErrorTextstringIs used when onlyFromSource is on true and user wants to add other tag.
textFieldobjectProperties of material TextField ( TextField)
chipobjectProperties of chip component used to present single tag ( Chip)
containerClassNamestringContainer div class, default is tags-container
containerStyleobjectContainer div style prop.
onRemovefunctionIs called on every remove tag. function(removedTag,allTags)
onAddfunctionIs called after tag is added to list. function(addedTag,allTags)
buttonobjectFloatingActionButton component props. Most important is child prop, default is ContentAdd which shows add icon. Default object looks like: {child:<ContentAdd />}

Usage

Add to your code (ES6):import Tags from 'react-material-tags';

Add to your code (ES5):var Tags = require('react-material-tags');

render(){ const sourceTags=[ {label:"America"}, {label:"Europe"}, {label:"Africa"}, {label:"Asia"}, {label:"Australia"} ]; const defTags=[ {label:"America"} ]; return ( <Tags defTags={defTags} sourceTags={sourceTags} /> ) }

Dependencies

Component requires to work Metarial-Ui library - Metrial UI

Authors and Contributors

Author of component is Maciej Sikora - @maciejsikora. Script is on MIT licence.

Support or Contact

Having trouble with Pages? Check out our documentation or contact support and we’ll help you sort it out.