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 Name class Source component.tags.css.tagsGithub
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/tagsBase URL to prepend to each tag. extraClassstringundefinedAdditional CSS, 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 = "/tags" />
HTML example (list layout) < a href = "/tags/css" >css</ a >
< a href = "/tags/astro" >astro</ a >
< a href = "/tags/basics" >basics</ a >
HTML example (inline layout) < ul class = "tags tags-inline" >
< a href = "/tags/css" >css</ a >
< a href = "/tags/astro" >astro</ a >
< a href = "/tags/basics" >basics</ a >