Krizaka
Documentation

Chip link

A chip that is a link — a filter that is an address — with the look of Chip, the current one marked, and chipVariants to style anything else; server-safe.

WebBetaNavigation

Web only — React, from @krizaka/ui/chip-link. Beta: its API may still change in a minor version.

When to use

  • Filters that change the address (/explore?tag=night): each tag is a link, shareable and server-rendered.

When not to use

  • To select options in a form or filter a list in place, without changing the address.Use instead: Chip
  • For a section switch that is not a filter.Use instead: Tabs

Installation

Install

npm install @krizaka/ui@beta @krizaka/tailwind@beta @krizaka/tokens@beta tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { ChipLink, chipVariants } from "@krizaka/ui/chip-link";

Examples

Filters that are links

Tags as links, the current one marked — rendered on the server.

Props

A filter that is a link, with the look of Chip.

PropTypeDefaultDescription
asChildboolean—Renders your router's <Link> with the chip's look.
current"true" | "page"pageWhat aria-current says when selected: page (a filter that is a page) or true.
selectedbooleanfalseThe current filter: the accent, aria-current (page by default) and data-state="on".
size"sm" | "md"mdsm · md.

Accessibility

  • Real links: the role, the focus and the keyboard come from the platform.
  • The current filter carries aria-current, not only a colour.

Keyboard

KeysAction
EnterFollows the link.

Best practices

  • Mark the current filter with selected: aria-current="page" says it, the accent shows it.
  • Wrap the links in a nav named for what they filter.
  • Use asChild with your router's link; chipVariants({ selected }) for anything else.

Generated from the code of @krizaka/ui 2.3.0: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page