tag
Information
- Folder
src/components/patterns/tags/tag
Files
Schema
$schema: http://json-schema.org/draft-07/schema
$id: /patterns/tags/tag
additionalProperties: false
type: object
required:
- label
properties:
label:
type: string
url:
type: string
format: uri-reference
button:
type: boolean
Mocks
label: Tag
$variants:
- $name: With link
url: url
label: Tag with link
- $name: With remove button
label: Tag with remove button
button: true
Template
{% if url %}
<a class="Tag u-typo-TextS Tag--link u-link" href="{{ url }}">{{ label }}</a>
{% else %}
<span class="Tag js-Tag u-typo-TextS">
<span class="Tag-label js-Tag-label">{{ label }}</span>
{%- if button %}
<button class="Tag-button js-Tag-button" type="button">
<span class="u-hiddenVisually">{{ "tag.remove_button_text"|tc }}</span>
{% include "@elements/icon/icon.twig" with {
classes: ["Tag-icon"],
name: "close",
} only %}
</button>
{% endif -%}
</span>
{% endif %}
Variants