Zum Inhalt springen

TagsList

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

The TagsList component renders a collection of tags with customizable layouts and sorting options.

See live demo →

import { TagsList } from 'starlight-tags/components';
Prop Type Default Description
tagIds string[] - Specific tag IDs to display
tags ProcessedTag[] - Pre-fetched tag objects (for advanced use)
limit number - Maximum number of tags to show
title string undefined Optional heading above tags
showCount boolean false Show page counts on badges
layout 'inline' | 'grid' | 'list' 'inline' Layout style
variant 'solid' | 'outline' | 'ghost' 'solid' Badge visual style
sortBy 'name' | 'count' 'name' Sort order

Show all tags:

import { TagsList } from 'starlight-tags/components';
<TagsList />

That’s it! The component fetches all tags automatically.

Display only specific tags by ID:

<TagsList tagIds={['authentication', 'rest-api', 'webhooks']} />

Show only a certain number of tags:

<TagsList limit={6} />

Tags flow horizontally and wrap:

<TagsList layout="inline" />

Tags in a responsive grid:

<TagsList layout="grid" />

Tags stacked vertically:

<TagsList layout="list" />

Add a heading above the tags:

<TagsList title="Related Topics" />

Alphabetical order:

<TagsList sortBy="name" />

Most used tags first:

<TagsList sortBy="count" />

Show how many pages use each tag:

<TagsList showCount />
<TagsList variant="solid" />
<TagsList variant="outline" />
<TagsList variant="ghost" />
<TagsList
title="Popular Topics"
layout="grid"
sortBy="count"
showCount
variant="outline"
limit={6}
/>
<TagsList
tagIds={['stable', 'beta', 'deprecated']}
title="API Status"
variant="outline"
/>
<TagsList
tagIds={['sdk-python', 'sdk-node', 'sdk-go']}
title="Available SDKs"
showCount
/>

For advanced filtering or custom data sources:

---
import { TagsList } from 'starlight-tags/components';
const { allTagsSorted } = Astro.locals.starlightTags;
// Custom filtering
const popularTags = allTagsSorted.filter(tag => tag.count >= 3);
---
<TagsList tags={popularTags} title="Popular Tags" />