tag Component
Tag Class API Reference
| Type | Class Options | Usage | Notes |
|---|---|---|---|
| Base | tag |
Required base class | Always required |
tags |
Container for multiple tags | Wrapper element for tag groups | |
| Style Variants | outline |
Border only, no fill | Modifier to tag |
basic |
Minimal styling | Light appearance | |
circular |
Fully rounded edges | Pill shape | |
square |
No rounded edges | Sharp corners | |
ribbon |
Ribbon style tag | Can be combined with left or right |
|
pointing |
Arrow pointing style | Use with above, below, left, right |
|
| Size | tiny |
Extra small size | Optional modifier |
small |
Small size | Optional modifier | |
| (default) | Medium size | No class needed | |
large |
Large size | Optional modifier | |
big |
Extra large size | Optional modifier | |
| Color (Semantic) | primary |
Main action color | Blue-based |
positive |
Success/confirm | Green-based | |
negative |
Danger/error | Red-based | |
warning |
Caution/alert | Yellow/orange-based | |
info |
Information | Blue-based | |
| Color (Extended) | red, orange, yellow |
Warm colors | Direct color names |
olive, green, teal |
Green spectrum | Direct color names | |
blue, violet, purple, pink, brown, grey, black |
Cool & neutral colors | Direct color names | |
| Interactive | clickable |
Clickable tag | Shows hover effect |
checkable |
Toggle selection | Can be checked/unchecked | |
checked |
Selected state | For checkable tags | |
animated |
Animated transitions | Smooth state changes | |
| Special | connected |
Connected group | Apply to container |
tag-input |
Tag input field | Dynamic tag creation | |
close |
Close button | Removable tag element |
Combination Examples
tag small primary - Small primary tagtag outline negative - Negative outline tagtag circular positive - Circular positive tagtag clickable checkable - Interactive selectable tagtags tiny primary connected - Connected tiny primary tagsTag Colors
Semantic Colors
Preview
Code
Extended Color Palette
Preview
Code
Style Variations
Outline Style
Preview
Code
Basic Style (Minimal)
Preview
Code
Shape Variations
Preview
Code
Special Tag Styles
Ribbon Style
Preview
Code
Pointing Tags
Preview
Code
Points Above
Points Below
Points Left
Points Right
Connected Tags
Preview
Code
Tag Input Field
Dynamic Tag Creation
Preview
Code
Type and press Enter or comma to create tags. Use Backspace to remove.
Container Inheritance
Size Inheritance
Preview
Code
Color Inheritance
Preview
Code
Combined Size & Color Inheritance
Preview
Code
Individual Overrides
Preview
Code
Common Use Cases
Category Tags
Preview
Code
Status Indicators
Preview
Code
Applied Filters
Preview
Code
User Tags
Preview
Code
Skills & Technologies
Preview
Code
Frontend
Backend
Databases
JavaScript API
TagManager Methods
Preview
Code
// Add a tag programmatically
TagManager.add('#my-container', 'New Tag', {
color: 'primary',
size: 'small',
closable: true,
clickable: true
});
// Remove a tag
TagManager.remove('.tag:first-child');
// Clear all tags
TagManager.clear('#my-container');
// Get all tag values
const values = TagManager.getValues('#my-container');
// Check if tag exists
const exists = TagManager.exists('#my-container', 'JavaScript');
// Listen to events
document.addEventListener('tag:created', (e) => {
console.log('Tag created:', e.detail.text);
});
document.addEventListener('tag:removed', (e) => {
console.log('Tag removed:', e.detail.text);
});
document.addEventListener('tag:clicked', (e) => {
console.log('Tag clicked:', e.detail.text);
});
document.addEventListener('tag:toggled', (e) => {
console.log('Tag toggled:', e.detail.text, e.detail.checked);
});
Tag Input Configuration
Preview
Code
// Initialize tag input with options
const tagInput = new TagInput('.tag-input', {
unique: true, // Prevent duplicates
maxTags: 10, // Maximum number of tags
minLength: 2, // Minimum character length
maxLength: 20, // Maximum character length
separators: [',', 'Enter'], // Keys that create tags
placeholder: 'Add tag...',
onAdd: (tag) => console.log('Added:', tag),
onRemove: (tag) => console.log('Removed:', tag)
});
Usage Guidelines
- • Tags are inline-flex elements that automatically wrap in their container
- • Use
.tagscontainer for proper spacing between tags - • Container-level sizing and colors reduce repetitive class declarations
- • Combine multiple modifiers for complex tag styles
- • Interactive tags (clickable, checkable) require JavaScript for full functionality
- • Close buttons in tags automatically handle removal with smooth animations