SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

FilterLinks

A row of links that narrow one list, such as a feed filtered by post type.

View code
tsx
<FilterLinks aria-label="Filter by type">
	<FilterLinks.Link href="?type=all" current>
		Everything <FilterLinks.Count>86</FilterLinks.Count>
	</FilterLinks.Link>
	<FilterLinks.Link href="?type=essays">
		Essays <FilterLinks.Count>24</FilterLinks.Count>
	</FilterLinks.Link>
	…
</FilterLinks>

<FilterLinks
	aria-label="Filter by type, outlined"
	mix={[
		raw({
			"--ui-filter-links-link-radius": "0.25rem",
			"--ui-filter-links-link-border-width": "1px",
			"--ui-filter-links-link-border-color": "var(--ui-neutral-border)",
			"--ui-filter-links-link-text-transform": "uppercase",
			"--ui-filter-links-link-letter-spacing": "0.06em",
			"--ui-filter-links-link-font-size": "0.75rem",
		}),
	]}
>
	…
</FilterLinks>

<FilterLinks
	aria-label="Filter by type, joined"
	mix={[
		raw({
			"--ui-filter-links-gap": "0",
			"--ui-filter-links-link-overlap": "-1px",
			"--ui-filter-links-link-radius": "0",
			"--ui-filter-links-link-border-width": "1px",
			"--ui-filter-links-link-border-color": "var(--ui-neutral-border)",
		}),
	]}
>
	…
</FilterLinks>

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";

Or copy it into your project to edit it:

Terminal
sdxc ui add filter-links

Usage

typescript
import { FilterLinks } from "@sdxc/ui";

Renders a <nav> holding one line of filter links. On a screen too narrow for every filter the line scrolls sideways with its scrollbar hidden, or wraps onto more lines with wrap. Restyle every link at once by setting FilterLinks.CustomProperties on the root.

Composition

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

  • FilterLinks
  • FilterLinks.LinkOne filter as a list item holding its link; the current one is announced as the current page.
  • FilterLinks.CountHow many entries the filter keeps, after its label in tabular figures and a little quieter.

Props

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

PropTypeDefaultRequiredDescription
wrapboolean—NoWraps the links onto more lines on a narrow screen, in place of scrolling sideways.

Also accepts everything in TagProps<"nav">.

Also accepts everything in TagProps<"span">.

@sdxc/ui

Can’t find it? Contact us