Tag field for SilverStripe

Installs: 546 669

Dependents: 26

Suggesters: 0

Security: 0

Stars: 54

Watchers: 17

Forks: 65


2.8.0-rc1 2021-11-24 04:21 UTC


Custom tag input field, for SilverStripe.

Build Status Code Quality Code coverage Version License SilverStripe supported module



Allows storing tags as a relationship, or comma-delimited strings. Supports autocompletion with lazy-loading.

Note: The field is optimised for usage in the SilverStripe CMS UI. The form field class itself can be used outside of the CMS, but you'll need to build your own frontend to interpret the raw field data (data-schema attribute).


  • SilverStripe 4.0


$ composer require silverstripe/tagfield


Relational Tags

use SilverStripe\ORM\DataObject;

class BlogPost extends DataObject
	private static $many_many = [
		'BlogTags' => BlogTag::class
use SilverStripe\ORM\DataObject;

class BlogTag extends DataObject
	private static $db = [
		'Title' => 'Varchar(200)',

	private static $belongs_many_many = [
		'BlogPosts' => BlogPost::class
$field = TagField::create(
	'Blog Tags',
	->setShouldLazyLoad(true) // tags should be lazy loaded
	->setCanCreate(true);     // new tag DataObjects can be created

Note: This assumes you have imported the namespaces class, e.g. use SilverStripe\TagField\TagField;

String Tags

use SilverStripe\ORM\DataObject;

class BlogPost extends DataObject
	private static $db = [
		'Tags' => 'Text',
$field = StringTagField::create(
    ['one', 'two'],
	explode(',', $this->Tags)

$field->setShouldLazyLoad(true); // tags should be lazy loaded

You can find more in-depth documentation in docs/en.


This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.