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.
File Description Source component.tags.cssAll tags styles (.tags) Github
Playground
<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 :
Property Description --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
Modifier Description .tagsDefault style (list layout). .tags-inlineInline layout using flex.
Astro component
Prop Type Default Description 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
import Tags from '../components/Tags.astro' ;
const { frontmatter } = Astro.props;
< Tags tagList ={frontmatter.tags} url = "/blog/tags" />
HTML example (list layout) < a href = "/blog/tags/css" >css</ a >
< a href = "/blog/tags/astro" >astro</ a >
< a href = "/blog/tags/basics" >basics</ a >