Skip to content

Link Group

The LinkGroup component renders an ordered collection of LinkItem entries using the Link component. It supports position-based variant assignment via an ordered slot system, flexible container semantics (div, ul, nav), and full delegation of per-item rendering, accessibility, and fallback behavior to Link.

import { LinkGroup } from "@/rokkit200-ui/components/link-group/link-group";
<LinkGroup
items={items}
className="flex gap-2"
linkClassName="w-1/3"
/>

When a single variant slot is provided, all items receive that variant.

The first item receives the first slot, all remaining items receive the second slot.

The first item receives the first slot, the second item receives the second slot, and all remaining items receive the third slot.

When as="nav" is used, the container renders as a <nav> element with aria-label from navLabel for accessible labeling.

When as="ul" is used, each link is automatically wrapped in an <li> element for valid list markup.

Invalid items are forwarded to Link, which renders them as a non-interactive <span> fallback. No items are silently dropped or hidden.

Get StartedUnresolved LinkContact Us
PropTypeDefaultDescription
itemsLinkItem[]Ordered collection of normalized link items. All items render in authored order.
variantSlotsVariantSlot[]["primary"]Ordered variant emphasis array. Maps onto items by index position (see Variant Slot Resolution).
as"div" | "ul" | "nav""div"Container element. Consumer chooses semantic wrapper based on block context.
classNamestringundefinedCSS classes applied to the container element.
linkClassNamestring | Partial<Record<VariantSlot, string>> | ((variant: VariantSlot, index: number) => string)undefinedOptional classes applied to each rendered Link. Supports a single class string, variant-keyed object map, or resolver function.
navLabelstringundefinedaria-label for the container when as="nav". Required when using nav.

The variantSlots array assigns visual emphasis to items by position. The rules are deterministic and do not depend on item content:

  • 1 slot: all items use slots[0].
  • 2 slots: index 0 uses slots[0], index 1+ uses slots[1].
  • 3+ slots: index 0 uses slots[0], index 1 uses slots[1], index 2+ uses slots[2]. Extra slots beyond 3 are ignored.
  • Default (no slots provided): all items receive "primary".
  • as="div" — default, no implicit semantic meaning.
  • as="ul" — each Link is wrapped in <li> for valid list markup.
  • as="nav" — renders <nav> with aria-label from navLabel. A dev warning is emitted when navLabel is omitted.
  • Per-item accessibility is inherited entirely from Link.
  • When as="nav", the container has an accessible label via navLabelaria-label.
  • When as="ul", valid <ul> / <li> semantics are maintained.
  • Invalid items remain visible — Link renders them as non-interactive <span> elements.
  • A dev warning is emitted when as="nav" is used without navLabel.
  • Link — per-item rendering, styling, accessibility, and fallback behavior
  • Button — shared variant system and visual language