# Tags Tag is a small, interactive element used to label, categorize or filter content. Tag allow users to quickly identify metadata and make selections. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tags--introduction ## Variants documented in Storybook - TonalTags: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tags--tonaltags - FilledTags: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tags--filledtags - OutlineTags: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tags--outlinetags - TextTags: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tags--texttags ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Tags. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Filled Tags — Rectangular HTML: ```html token Neutral token Brand token Success token Warning token Error token Info ``` React: ```jsx import React from 'react'; const TagsExample1Demo = () => ( <> {/* Variant: Filled Tag - Neutral */} token Neutral {/* Variant: Filled Tag - Brand */} token Brand {/* Variant: Filled Tag - Success */} token Success {/* Variant: Filled Tag - Warning */} token Warning {/* Variant: Filled Tag - Error */} token Error {/* Variant: Filled Tag - Info */} token Info > ); export default TagsExample1Demo; ``` Angular: ```html token Neutral token Brand token Success token Warning token Error token Info ``` ### 2. Filled Tags — Rectangular (Small) HTML: ```html token Neutral token Brand token Success token Warning token Error token Info ``` React: ```jsx import React from 'react'; const TagsExample2Demo = () => ( <> {/* Variant: Filled Tag - Neutral - Small */} token Neutral {/* Variant: Filled Tag - Brand - Small */} token Brand {/* Variant: Filled Tag - Success - Small */} token Success {/* Variant: Filled Tag - Warning - Small */} token Warning {/* Variant: Filled Tag - Error - Small */} token Error {/* Variant: Filled Tag - Info - Small */} token Info > ); export default TagsExample2Demo; ``` Angular: ```html token Neutral token Brand token Success token Warning token Error token Info ``` ### 3. Filled Tags — Circular (Pill) HTML: ```html token Neutral token Brand token Success token Warning token Error token Info ``` React: ```jsx import React from 'react'; const TagsExample3Demo = () => ( <> {/* Variant: Filled Tag - Neutral - Pill */} token Neutral {/* Variant: Filled Tag - Brand - Pill */} token Brand {/* Variant: Filled Tag - Success - Pill */} token Success {/* Variant: Filled Tag - Warning - Pill */} token Warning {/* Variant: Filled Tag - Error - Pill */} token Error {/* Variant: Filled Tag - Info - Pill */} token Info > ); export default TagsExample3Demo; ``` Angular: ```html token Neutral token Brand token Success token Warning token Error token Info ``` ### 4. Filled Tags — Circular (Pill) (Small) HTML: ```html token Neutral token Brand token Success token Warning token Error token Info ``` React: ```jsx import React from 'react'; const TagsExample4Demo = () => ( <> {/* Variant: Filled Tag - Neutral - Small Pill */} token Neutral {/* Variant: Filled Tag - Brand - Small Pill */} token Brand {/* Variant: Filled Tag - Success - Small Pill */} token Success {/* Variant: Filled Tag - Warning - Small Pill */} token Warning {/* Variant: Filled Tag - Error - Small Pill */} token Error {/* Variant: Filled Tag - Info - Small Pill */} token Info > ); export default TagsExample4Demo; ``` Angular: ```html token Neutral token Brand token Success token Warning token Error token Info ``` ### 5. Introduction — Introduction HTML: ```html
Tag is a small, interactive element used to label, categorize or filter content. Tag allow users to quickly identify metadata and make selections.
Visual demonstration of various tag variants including Tonal, Filled, Outline, and Text styles.
Quickly copy sizing and variant utility classes for Tags.
|
Tonal Variant
ux4g-tag-tonal-{v}
|
|
Filled Variant
ux4g-tag-filled-{v}
|
|
Outline Variant
ux4g-tag-outline-{v}
|
|
Text Variant
ux4g-tag-text-{v}
|
|
Primary (Brand)
primary
|
|
Neutral / Default
neutral
|
|
Success (Positive)
success
|
|
Warning (Caution)
warning
|
|
Error (Critical)
error
|
|
Info (Action)
info
|
|
Small Size
ux4g-tag-s
|
|
Radius None
ux4g-radius-none
|
|
Radius Small
ux4g-radius-s
|
|
Radius Medium
ux4g-radius-m
|
|
Radius Large
ux4g-radius-l
|
|
Circular (Pill)
ux4g-radius-full
|
Tag is a small, interactive element used to label, categorize or filter content. Tag allow users to quickly identify metadata and make selections.
Visual demonstration of various tag variants including Tonal, Filled, Outline, and Text styles.
{/* Tonal Tags Showcase */}Quickly copy sizing and variant utility classes for Tags.
|
Tonal Variant
ux4g-tag-tonal-{v}
|
|
Filled Variant
ux4g-tag-filled-{v}
|
|
Outline Variant
ux4g-tag-outline-{v}
|
|
Text Variant
ux4g-tag-text-{v}
|
|
Primary (Brand)
primary
|
|
Neutral / Default
neutral
|
|
Success (Positive)
success
|
|
Warning (Caution)
warning
|
|
Error (Critical)
error
|
|
Info (Action)
info
|
|
Small Size
ux4g-tag-s
|
|
Radius None
ux4g-radius-none
|
|
Radius Small
ux4g-radius-s
|
|
Radius Medium
ux4g-radius-m
|
|
Radius Large
ux4g-radius-l
|
|
Circular (Pill)
ux4g-radius-full
|
Tag is a small, interactive element used to label, categorize or filter content. Tag allow users to quickly identify metadata and make selections.
Visual demonstration of various tag variants including Tonal, Filled, Outline, and Text styles.
Quickly copy sizing and variant utility classes for Tags.
|
Tonal Variant
ux4g-tag-tonal-{v}
|
|
Filled Variant
ux4g-tag-filled-{v}
|
|
Outline Variant
ux4g-tag-outline-{v}
|
|
Text Variant
ux4g-tag-text-{v}
|
|
Primary (Brand)
primary
|
|
Neutral / Default
neutral
|
|
Success (Positive)
success
|
|
Warning (Caution)
warning
|
|
Error (Critical)
error
|
|
Info (Action)
info
|
|
Small Size
ux4g-tag-s
|
|
Radius None
ux4g-radius-none
|
|
Radius Small
ux4g-radius-s
|
|
Radius Medium
ux4g-radius-m
|
|
Radius Large
ux4g-radius-l
|
|
Circular (Pill)
ux4g-radius-full
|