component :: Tags

The .tags component styles a list of tags. It supports both list and inline layouts, is accessible by default, and customizable via CSS custom properties.

FileDescriptionSource
component.tags.cssAll tags styles (.tags)Github

Playground

Variation

Layout
Copied!
<ul class="tags">
<li><a href="#">css</a></li>
<li><a href="#">astro</a></li>
<li><a href="#">basics</a></li>
</ul>

HTML

Custom properties

The following custom properties are available in the default theme:

PropertyDescription
--tags-paddingTag padding.
--tags-font-sizeTag font size.
--tags-colorTag text color.
--tags-background-colorTag background color.
--tags-background-color-hoverTag hover background color.
--tags-radiusTag border radius.

Available modifiers

ModifierDescription
.tagsDefault style (list layout).
.tags-inlineInline layout using flex.

Astro component

PropTypeDefaultDescription
tagListstring[][]Array of tag strings to display.
variantstringinlineInline or list layout.
urlstring/blog/tagsBase URL to prepend to each tag.
sortbooleanfalseSort tags alphabetically; input order is preserved by default.
classstringundefinedAdditional CSS classes, useful for helper classes.
ariaLabelstring'Tags'Accessible label for the tag list.
data-testidstring'tags'Test ID for testing purposes.

Examples