SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

TagList

A post's tags as a wrapping row of links to each tag's page, every one led by a prefix such as #.

View code
tsx
import { TagList } from "@sdxc/ui/blog";

let tags = [
	{ label: "caching", href: "/tags/caching" },
	{ label: "http", href: "/tags/http" },
	{ label: "edge", href: "/tags/edge" },
	{ label: "performance", href: "/tags/performance" },
];

<TagList>
	{tags.map((tag) => <TagList.Tag href={tag.href}>{tag.label}</TagList.Tag>)}
</TagList>
<TagList prefix="" aria-label="Topics">
	{tags.map((tag) => <TagList.Tag href={tag.href}>{tag.label}</TagList.Tag>)}
</TagList>

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { TagList } from "@sdxc/ui/blog";

Renders the tags as a <ul> that wraps onto as many lines as it needs, each tag kept whole on its line; a list with no tags renders nothing. Turn the links into chips or join them with a separator through TagList.CustomProperties.

Composition

The parts the component publishes, each a static property of the host.

  • TagList
  • TagList.TagOne tag as a list item holding its link, the list's prefix set before the label and hidden from assistive technology.

Examples

tsx
<TagList prefix="" aria-label="Topics">…</TagList>
tsx
<TagList style={{ "--ui-tag-list-separator": '","' }}>…</TagList>

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeDefaultRequiredDescription
prefixstring—NoSet before every tag's label and hidden from assistive technology; an empty string shows the bare names.
"aria-label"string—NoThe list's accessible name.
childrenRemixNode—NoThe list's TagList.Tag parts.

Also accepts everything in TagPropsOf<"ul">.

TagList.Tag

@sdxc/ui

Can’t find it? Contact us