Skip to content
ui8kit

block / commerce

Category Nav

Categories as chips, a bar, a side list, tiles, or chips under a toolbar.

Install

npx ui8kit add category-nav

Pulls in: block, compose, container, group, inline, kit-box, kit-select, kit-text, list, list-item, lucide-icon, menu-entry, search-field, select, select-option, text, utils

Preview

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon,
  or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes:
  layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Category, CategoryTools } from "./category-nav.types";

  export type CategoryNavProps = {
    label: string;
    categories: Category[];
    current?: string;
    layout?: "chips" | "bar" | "sidebar" | "tiles" | "toolbar";
    count?: "show" | "hide";
    icon?: "show" | "hide";
    density?: "default" | "compact";
    tools?: CategoryTools;
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import Container from "../compose/Container.svelte";
  import Group from "../compose/Group.svelte";
  import Inline from "../compose/Inline.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Select from "../compose/Select.svelte";
  import SelectOption from "../compose/SelectOption.svelte";
  import Text from "../compose/Text.svelte";
  import MenuEntry from "../components/menu-entry.svelte";
  import SearchField from "../components/search-field.svelte";
  import { cn } from "../utils";

  let {
    label,
    categories,
    current = "all",
    layout = "chips",
    count = "show",
    icon = "show",
    density = "default",
    tools,
    landmarkLabel,
  }: CategoryNavProps = $props();
  const chipLike = $derived(((layout as string) === "chips") || ((layout as string) === "toolbar"));
  const tiles = $derived((layout as string) === "tiles");
  const linkShape = $derived(
    chipLike ? "inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border"
    : (layout as string) === "bar" ? "inline-flex items-center gap-2 -mb-px border-b px-1 py-2"
    : tiles ? "flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border"
    : "inline-flex w-full items-center gap-2 rounded px-3 py-2"
  );
  const currentLook = $derived(
    chipLike ? "bg-primary text-primary-foreground"
    : (layout as string) === "bar" ? "border-foreground font-semibold"
    : tiles ? "inset-ring-foreground font-semibold"
    : "bg-muted font-semibold"
  );
  const otherLook = $derived(((layout as string) === "bar") ? "border-transparent" : "");
  const listShape = $derived(
    (layout as string) === "sidebar" ? "flex flex-col gap-2"
    : (layout as string) === "bar" ? "flex flex-wrap gap-2 gap-x-4 border-b border-border"
    : tiles ? "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6"
    : "flex flex-wrap gap-2"
  );
</script>

<Block tag="nav" aria-label={(landmarkLabel ?? label)} data-layout={layout} data-slot="category-nav">
  <Container
    class={cn("mx-auto w-full max-w-6xl px-4", (((density as string) === "compact") ? "py-2" : "py-4"))}
    data-slot="container"
  >
    {#if ((layout as string) === "toolbar")}
      <Group gap="4" align="center" class="mb-4 flex-wrap" data-slot="toolbar">
        <SearchField value={(tools?.query ?? "")} label={(tools?.search ?? "")} placeholder={tools?.search} />
        <Select name="sort" size="sm" aria-label={tools?.sort} class="w-48">
          <SelectOption value="sort" label={tools?.sortValue} selected={true} />
        </Select>
        <Text size="sm" class="text-muted-foreground">
          {tools?.shown}
        </Text>
      </Group>
    {/if}
    {#if ((categories?.length ?? 0) > 0)}
      <List tag="ul" class={listShape} data-slot="items">
        {#each categories as c (c.id)}
          <ListItem data-slot="categories-row">
            <MenuEntry
              href={c.href}
              class={cn("text-sm", linkShape, ((c.id === current) ? currentLook : otherLook))}
              current={(c.id === current)}
              testid="item"
              block={true}
            >
              {#if ((icon as string) === "show")}
                {#if tiles}
                  <Inline class="flex size-10 items-center justify-center rounded bg-muted">
                    <LucideIcon name={c.icon} size={20} />
                  </Inline>
                {:else}
                  <LucideIcon name={c.icon} size={16} />
                {/if}
              {/if}
              <Inline>
                {c.name}
              </Inline>
              {#if ((count as string) === "show")}
                <Text size="xs" class="text-muted-foreground">
                  {(c.count == null ? undefined : String(c.count))}
                </Text>
              {/if}
            </MenuEntry>
          </ListItem>
        {/each}
      </List>
    {/if}
  </Container>
</Block>
blocks/category-nav.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Category = {
  id: string;
  name: string;
  icon: string;
  count: number;
  href?: string;
};

export type CategoryTools = {
  /** label of the search field */
  search?: string;
  /** label of the sort select */
  sort?: string;
  /** the chosen sort */
  sortValue?: string;
  /** how many products are shown */
  shown?: string;
  /** the text in the search field */
  query?: string;
};

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon,
 * or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes:
 * layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
 */
import { type ReactNode } from "react";
import { Block, Container, Group, Inline, List, ListItem, Select, SelectOption, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MenuEntry } from "../components/menu-entry";
import { SearchField } from "../components/search-field";
import { cn } from "../utils";
import type { Category, CategoryTools } from "./category-nav.types";

export type CategoryNavProps = {
  label: string;
  categories: Category[];
  current?: string;
  layout?: "chips" | "bar" | "sidebar" | "tiles" | "toolbar";
  count?: "show" | "hide";
  icon?: "show" | "hide";
  density?: "default" | "compact";
  tools?: CategoryTools;
  landmarkLabel?: string;
};

export function CategoryNav({
  label,
  categories,
  current = "all",
  layout = "chips",
  count = "show",
  icon = "show",
  density = "default",
  tools,
  landmarkLabel,
}: CategoryNavProps) {
  const chipLike = ((layout as string) === "chips") || ((layout as string) === "toolbar");
  const tiles = (layout as string) === "tiles";
  const linkShape =
    chipLike ? "inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border"
    : (layout as string) === "bar" ? "inline-flex items-center gap-2 -mb-px border-b px-1 py-2"
    : tiles ? "flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border"
    : "inline-flex w-full items-center gap-2 rounded px-3 py-2";
  const currentLook =
    chipLike ? "bg-primary text-primary-foreground"
    : (layout as string) === "bar" ? "border-foreground font-semibold"
    : tiles ? "inset-ring-foreground font-semibold"
    : "bg-muted font-semibold";
  const otherLook = ((layout as string) === "bar") ? "border-transparent" : "";
  const listShape =
    (layout as string) === "sidebar" ? "flex flex-col gap-2"
    : (layout as string) === "bar" ? "flex flex-wrap gap-2 gap-x-4 border-b border-border"
    : tiles ? "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6"
    : "flex flex-wrap gap-2";
  return (
    <Block tag="nav" aria-label={(landmarkLabel ?? label)} data-layout={layout} data-slot="category-nav">
      <Container
        className={cn(
          "mx-auto w-full max-w-6xl px-4",
          (((density as string) === "compact") ? "py-2" : "py-4")
        )}
        data-slot="container"
      >
        {((layout as string) === "toolbar") ? (
          <Group gap="4" align="center" className="mb-4 flex-wrap" data-slot="toolbar">
            <SearchField value={(tools?.query ?? "")} label={(tools?.search ?? "")} placeholder={tools?.search} />
            <Select name="sort" size="sm" aria-label={tools?.sort} className="w-48">
              <SelectOption value="sort" label={tools?.sortValue} selected={true} />
            </Select>
            <Text size="sm" className="text-muted-foreground">
              {tools?.shown}
            </Text>
          </Group>
        ) : null}
        {((categories?.length ?? 0) > 0) ? (
          <List tag="ul" className={listShape} data-slot="items">
            {(categories ?? []).map((c) => (
              <ListItem key={c.id} data-slot="categories-row">
                <MenuEntry
                  href={c.href}
                  className={cn("text-sm", linkShape, ((c.id === current) ? currentLook : otherLook))}
                  current={(c.id === current)}
                  testid="item"
                  block={true}
                >
                  {((icon as string) === "show") ? (
                    <>
                      {tiles ? (
                        <Inline className="flex size-10 items-center justify-center rounded bg-muted">
                          <LucideIcon name={c.icon} size={20} />
                        </Inline>
                      ) : (
                        <LucideIcon name={c.icon} size={16} />
                      )}
                    </>
                  ) : null}
                  <Inline>
                    {c.name}
                  </Inline>
                  {((count as string) === "show") ? (
                    <Text size="xs" className="text-muted-foreground">
                      {(c.count == null ? undefined : String(c.count))}
                    </Text>
                  ) : null}
                </MenuEntry>
              </ListItem>
            ))}
          </List>
        ) : null}
      </Container>
    </Block>
  );
}
blocks/category-nav.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Category = {
  id: string;
  name: string;
  icon: string;
  count: number;
  href?: string;
};

export type CategoryTools = {
  /** label of the search field */
  search?: string;
  /** label of the sort select */
  sort?: string;
  /** the chosen sort */
  sortValue?: string;
  /** how many products are shown */
  shown?: string;
  /** the text in the search field */
  query?: string;
};

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Category = {
  id: string;
  name: string;
  icon: string;
  count: number;
  href?: string;
};

export type CategoryTools = {
  /** label of the search field */
  search?: string;
  /** label of the sort select */
  sort?: string;
  /** the chosen sort */
  sortValue?: string;
  /** how many products are shown */
  shown?: string;
  /** the text in the search field */
  query?: string;
};
blocks/category-nav.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon,
  or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes:
  layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
-->
<script lang="ts">
import type { Category, CategoryTools } from "./category-nav.types";

export type CategoryNavProps = {
  label: string;
  categories: Category[];
  current?: string;
  layout?: "chips" | "bar" | "sidebar" | "tiles" | "toolbar";
  count?: "show" | "hide";
  icon?: "show" | "hide";
  density?: "default" | "compact";
  tools?: CategoryTools;
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import { computed } from "vue";
import Block from "../compose/Block.vue";
import Container from "../compose/Container.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Select from "../compose/Select.vue";
import SelectOption from "../compose/SelectOption.vue";
import Text from "../compose/Text.vue";
import MenuEntry from "../components/menu-entry.vue";
import SearchField from "../components/search-field.vue";
import { cn } from "../utils";

const {
  label,
  categories,
  current = "all",
  layout = "chips",
  count = "show",
  icon = "show",
  density = "default",
  tools,
  landmarkLabel,
} = defineProps<CategoryNavProps>();
const chipLike = computed(() => ((layout as string) === "chips") || ((layout as string) === "toolbar"));
const tiles = computed(() => (layout as string) === "tiles");
const linkShape = computed(() =>
  chipLike.value ? "inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border"
  : (layout as string) === "bar" ? "inline-flex items-center gap-2 -mb-px border-b px-1 py-2"
  : tiles.value ? "flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border"
  : "inline-flex w-full items-center gap-2 rounded px-3 py-2"
);
const currentLook = computed(() =>
  chipLike.value ? "bg-primary text-primary-foreground"
  : (layout as string) === "bar" ? "border-foreground font-semibold"
  : tiles.value ? "inset-ring-foreground font-semibold"
  : "bg-muted font-semibold"
);
const otherLook = computed(() => ((layout as string) === "bar") ? "border-transparent" : "");
const listShape = computed(() =>
  (layout as string) === "sidebar" ? "flex flex-col gap-2"
  : (layout as string) === "bar" ? "flex flex-wrap gap-2 gap-x-4 border-b border-border"
  : tiles.value ? "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6"
  : "flex flex-wrap gap-2"
);
</script>

<template>
  <Block tag="nav" :aria-label="(landmarkLabel ?? label)" :data-layout="layout" data-slot="category-nav">
    <Container
      :class="cn('mx-auto w-full max-w-6xl px-4', (((density as string) === 'compact') ? 'py-2' : 'py-4'))"
      data-slot="container"
    >
      <Group
        v-if="((layout as string) === 'toolbar')"
        gap="4"
        align="center"
        class="mb-4 flex-wrap"
        data-slot="toolbar"
      >
        <SearchField :value="(tools?.query ?? '')" :label="(tools?.search ?? '')" :placeholder="tools?.search" />
        <Select name="sort" size="sm" :aria-label="tools?.sort" class="w-48">
          <SelectOption value="sort" :label="tools?.sortValue" :selected="true" />
        </Select>
        <Text size="sm" class="text-muted-foreground">
          {{ tools?.shown }}
        </Text>
      </Group>
      <List v-if="((categories?.length ?? 0) > 0)" tag="ul" :class="listShape" data-slot="items">
        <ListItem v-for="c in categories" :key="c.id" data-slot="categories-row">
          <MenuEntry
            :href="c.href"
            :class="cn('text-sm', linkShape, ((c.id === current) ? currentLook : otherLook))"
            :current="(c.id === current)"
            testid="item"
            :block="true"
          >
            <template v-if="((icon as string) === 'show')">
              <Inline v-if="tiles" class="flex size-10 items-center justify-center rounded bg-muted">
                <LucideIcon :name="c.icon" :size="20" />
              </Inline>
              <LucideIcon v-else :name="c.icon" :size="16" />
            </template>
            <Inline>
              {{ c.name }}
            </Inline>
            <Text v-if="((count as string) === 'show')" size="xs" class="text-muted-foreground">
              {{ (c.count == null ? undefined : String(c.count)) }}
            </Text>
          </MenuEntry>
        </ListItem>
      </List>
    </Container>
  </Block>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon,
 * or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes:
 * layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
 */
import { For, type JSX } from "solid-js";
import { Block, Container, Group, Inline, List, ListItem, Select, SelectOption, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MenuEntry } from "../components/menu-entry";
import { SearchField } from "../components/search-field";
import { cn } from "../utils";
import type { Category, CategoryTools } from "./category-nav.types";

export type CategoryNavProps = {
  label: string;
  categories: Category[];
  current?: string;
  layout?: "chips" | "bar" | "sidebar" | "tiles" | "toolbar";
  count?: "show" | "hide";
  icon?: "show" | "hide";
  density?: "default" | "compact";
  tools?: CategoryTools;
  landmarkLabel?: string;
};

export function CategoryNav({
  label,
  categories,
  current = "all",
  layout = "chips",
  count = "show",
  icon = "show",
  density = "default",
  tools,
  landmarkLabel,
}: CategoryNavProps) {
  const chipLike = ((layout as string) === "chips") || ((layout as string) === "toolbar");
  const tiles = (layout as string) === "tiles";
  const linkShape =
    chipLike ? "inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border"
    : (layout as string) === "bar" ? "inline-flex items-center gap-2 -mb-px border-b px-1 py-2"
    : tiles ? "flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border"
    : "inline-flex w-full items-center gap-2 rounded px-3 py-2";
  const currentLook =
    chipLike ? "bg-primary text-primary-foreground"
    : (layout as string) === "bar" ? "border-foreground font-semibold"
    : tiles ? "inset-ring-foreground font-semibold"
    : "bg-muted font-semibold";
  const otherLook = ((layout as string) === "bar") ? "border-transparent" : "";
  const listShape =
    (layout as string) === "sidebar" ? "flex flex-col gap-2"
    : (layout as string) === "bar" ? "flex flex-wrap gap-2 gap-x-4 border-b border-border"
    : tiles ? "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6"
    : "flex flex-wrap gap-2";
  return (
    <Block tag="nav" aria-label={(landmarkLabel ?? label)} data-layout={layout} data-slot="category-nav">
      <Container
        class={cn("mx-auto w-full max-w-6xl px-4", (((density as string) === "compact") ? "py-2" : "py-4"))}
        data-slot="container"
      >
        {((layout as string) === "toolbar") ? (
          <Group gap="4" align="center" class="mb-4 flex-wrap" data-slot="toolbar">
            <SearchField value={(tools?.query ?? "")} label={(tools?.search ?? "")} placeholder={tools?.search} />
            <Select name="sort" size="sm" aria-label={tools?.sort} class="w-48">
              <SelectOption value="sort" label={tools?.sortValue} selected={true} />
            </Select>
            <Text size="sm" class="text-muted-foreground">
              {tools?.shown}
            </Text>
          </Group>
        ) : null}
        {((categories?.length ?? 0) > 0) ? (
          <List tag="ul" class={listShape} data-slot="items">
            <For each={categories ?? []}>{(c) => (
              <ListItem data-slot="categories-row">
                <MenuEntry
                  href={c.href}
                  class={cn("text-sm", linkShape, ((c.id === current) ? currentLook : otherLook))}
                  current={(c.id === current)}
                  testid="item"
                  block={true}
                >
                  {((icon as string) === "show") ? (
                    <>
                      {tiles ? (
                        <Inline class="flex size-10 items-center justify-center rounded bg-muted">
                          <LucideIcon name={c.icon} size={20} />
                        </Inline>
                      ) : (
                        <LucideIcon name={c.icon} size={16} />
                      )}
                    </>
                  ) : null}
                  <Inline>
                    {c.name}
                  </Inline>
                  {((count as string) === "show") ? (
                    <Text size="xs" class="text-muted-foreground">
                      {(c.count == null ? undefined : String(c.count))}
                    </Text>
                  ) : null}
                </MenuEntry>
              </ListItem>
            )}</For>
          </List>
        ) : null}
      </Container>
    </Block>
  );
}
blocks/category-nav.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Category = {
  id: string;
  name: string;
  icon: string;
  count: number;
  href?: string;
};

export type CategoryTools = {
  /** label of the search field */
  search?: string;
  /** label of the sort select */
  sort?: string;
  /** the chosen sort */
  sortValue?: string;
  /** how many products are shown */
  shown?: string;
  /** the text in the search field */
  query?: string;
};

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/category-nav.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/icons"
	selectfield "github.com/ui8kit/codegen/generated/templ/ui/select"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// CategoryNavProps are the props of CategoryNav; the values are the JSON shapes of the TypeScript props.
type CategoryNavProps struct {
	Label any `json:"label"`
	Categories any `json:"categories"`
	Current any `json:"current"`
	Layout any `json:"layout"`
	Count any `json:"count"`
	Icon any `json:"icon"`
	Density any `json:"density"`
	Tools any `json:"tools"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon, or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes: layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
templ CategoryNav(p CategoryNavProps) {
	{{ vLabel := p.Label }}
	{{ vCategories := p.Categories }}
	{{ vCurrent := uiutils.Def(p.Current, "all") }}
	{{ vLayout := uiutils.Def(p.Layout, "chips") }}
	{{ vCount := uiutils.Def(p.Count, "show") }}
	{{ vIcon := uiutils.Def(p.Icon, "show") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vTools := p.Tools }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	{{ vChipLike := any(uiutils.Or(uiutils.Eq(vLayout, "chips"), uiutils.Eq(vLayout, "toolbar"))) }}
	{{ vTiles := any(uiutils.Eq(vLayout, "tiles")) }}
	{{ vLinkShape := any(uiutils.Cond(uiutils.T(vChipLike), "inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "bar")), "inline-flex items-center gap-2 -mb-px border-b px-1 py-2", uiutils.Cond(uiutils.T(vTiles), "flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border", "inline-flex w-full items-center gap-2 rounded px-3 py-2")))) }}
	{{ vCurrentLook := any(uiutils.Cond(uiutils.T(vChipLike), "bg-primary text-primary-foreground", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "bar")), "border-foreground font-semibold", uiutils.Cond(uiutils.T(vTiles), "inset-ring-foreground font-semibold", "bg-muted font-semibold")))) }}
	{{ vOtherLook := any(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "bar")), "border-transparent", "")) }}
	{{ vListShape := any(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "sidebar")), "flex flex-col gap-2", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "bar")), "flex flex-wrap gap-2 gap-x-4 border-b border-border", uiutils.Cond(uiutils.T(vTiles), "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6", "flex flex-wrap gap-2")))) }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "nav", Attrs: uiutils.Attrs("aria-label", uiutils.Coalesce(vLandmarkLabel, vLabel), "data-layout", vLayout, "data-slot", "category-nav")}}) {
		@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full max-w-6xl px-4", uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "py-2", "py-4"))), Attrs: uiutils.Attrs("data-slot", "container")}}) {
			if uiutils.Eq(vLayout, "toolbar") {
				@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Class: "mb-4 flex-wrap", Attrs: uiutils.Attrs("data-slot", "toolbar")}}) {
					@SearchField(SearchFieldProps{Value: uiutils.Coalesce(uiutils.Get(vTools, "query"), ""), Label: uiutils.Coalesce(uiutils.Get(vTools, "search"), ""), Placeholder: uiutils.Get(vTools, "search")})
					@compose.Select(compose.SelectProps{Size: "sm", SelectProps: selectfield.SelectProps{Name: "sort", Class: "w-48", Attrs: uiutils.Attrs("aria-label", uiutils.Get(vTools, "sort"))}}) {
						@selectfield.SelectOption(selectfield.SelectOptionProps{Value: uiutils.SP("sort"), Selected: true, Attrs: uiutils.Attrs("label", uiutils.Get(vTools, "sortValue"))})
					}
					@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
						{ uiutils.Text(uiutils.Get(vTools, "shown")) }
					}
				}
			}
			if uiutils.Gt(uiutils.Len(vCategories), float64(0)) {
				@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: uiutils.S(vListShape), Attrs: uiutils.Attrs("data-slot", "items")}}) {
					for _, vC := range uiutils.L(vCategories) {
						@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "categories-row")}}) {
							@MenuEntry(MenuEntryProps{Href: uiutils.Get(vC, "href"), Class: uiutils.Cnv(uiutils.Cnv("text-sm", vLinkShape, uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vC, "id"), vCurrent)), vCurrentLook, vOtherLook))), Current: uiutils.Eq(uiutils.Get(vC, "id"), vCurrent), Testid: "item", Block: true}) {
								if uiutils.Eq(vIcon, "show") {
									if uiutils.T(vTiles) {
										@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex size-10 items-center justify-center rounded bg-muted"}}) {
											@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vC, "icon")), Size: 20})
										}
									} else {
										@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vC, "icon")), Size: 16})
									}
								}
								@compose.Inline(compose.InlineProps{TextProps: text.TextProps{}}) {
									{ uiutils.Text(uiutils.Get(vC, "name")) }
								}
								if uiutils.Eq(vCount, "show") {
									@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
										{ uiutils.Text(uiutils.Str(uiutils.Get(vC, "count"))) }
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/category-nav.json
    Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon, or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes: layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
    Props (p): label, categories, current, layout, count, icon, density, tools, landmarkLabel. -#}
{%- set v_label = (p.label ?? null) -%}
{%- set v_categories = (p.categories ?? null) -%}
{%- set v_current = (p.current ?? 'all') -%}
{%- set v_layout = (p.layout ?? 'chips') -%}
{%- set v_count = (p.count ?? 'show') -%}
{%- set v_icon = (p.icon ?? 'show') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_tools = (p.tools ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set v_chipLike = og_or([og_eq(v_layout, 'chips'), og_eq(v_layout, 'toolbar')]) -%}
{%- set v_tiles = og_eq(v_layout, 'tiles') -%}
{%- set v_linkShape = (og_t(v_chipLike) ? 'inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border' : (og_t(og_eq(v_layout, 'bar')) ? 'inline-flex items-center gap-2 -mb-px border-b px-1 py-2' : (og_t(v_tiles) ? 'flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border' : 'inline-flex w-full items-center gap-2 rounded px-3 py-2'))) -%}
{%- set v_currentLook = (og_t(v_chipLike) ? 'bg-primary text-primary-foreground' : (og_t(og_eq(v_layout, 'bar')) ? 'border-foreground font-semibold' : (og_t(v_tiles) ? 'inset-ring-foreground font-semibold' : 'bg-muted font-semibold'))) -%}
{%- set v_otherLook = (og_t(og_eq(v_layout, 'bar')) ? 'border-transparent' : '') -%}
{%- set v_listShape = (og_t(og_eq(v_layout, 'sidebar')) ? 'flex flex-col gap-2' : (og_t(og_eq(v_layout, 'bar')) ? 'flex flex-wrap gap-2 gap-x-4 border-b border-border' : (og_t(v_tiles) ? 'grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6' : 'flex flex-wrap gap-2'))) -%}
{%- set c_11 -%}
  {%- set c_10 -%}
    {%- if og_t(og_eq(v_layout, 'toolbar')) %}
      {%- set c_3 -%}
        {{ include('blocks/search-field.html.twig', {'p': {'value': og_coalesce([og_get(v_tools, ['query']), '']), 'label': og_coalesce([og_get(v_tools, ['search']), '']), 'placeholder': og_get(v_tools, ['search'])}}, with_context = false) }}
        {%- set c_1 -%}
          {{ include('ui/select/SelectOption.html.twig', {'value': 'sort', 'selected': true, 'attrs': og_attrs(['label', og_get(v_tools, ['sortValue'])])}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Select.html.twig', {'name': 'sort', 'size': 'sm', 'class': 'w-48', 'attrs': og_attrs(['aria-label', og_get(v_tools, ['sort'])]), 'children': c_1}, with_context = false) }}
        {%- set c_2 -%}
          {{ og_text(og_get(v_tools, ['shown'])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'class': 'mb-4 flex-wrap', 'attrs': og_attrs(['data-slot', 'toolbar']), 'children': c_3}, with_context = false) }}
    {%- endif %}
    {%- if og_t(og_gt(og_len(v_categories), 0)) %}
      {%- set c_9 -%}
        {%- for v_c in og_l(v_categories) %}
          {%- set c_8 -%}
            {%- set c_7 -%}
              {%- if og_t(og_eq(v_icon, 'show')) %}
                {%- if og_t(v_tiles) %}
                  {%- set c_4 -%}
                    {{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_c, ['icon'])), 'size': 20}, with_context = false) }}
                  {%- endset -%}
                  {{ include('compose/Inline.html.twig', {'class': 'flex size-10 items-center justify-center rounded bg-muted', 'children': c_4}, with_context = false) }}
                {%- else %}
                  {{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_c, ['icon'])), 'size': 16}, with_context = false) }}
                {%- endif %}
              {%- endif %}
              {%- set c_5 -%}
                {{ og_text(og_get(v_c, ['name'])) }}
              {%- endset -%}
              {{ include('compose/Inline.html.twig', {'children': c_5}, with_context = false) }}
              {%- if og_t(og_eq(v_count, 'show')) %}
                {%- set c_6 -%}
                  {{ og_text(og_str(og_get(v_c, ['count']))) }}
                {%- endset -%}
                {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_6}, with_context = false) }}
              {%- endif %}
            {%- endset -%}
            {{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_c, ['href']), 'className': og_cnv([og_cnv(['text-sm', v_linkShape, (og_t(og_eq(og_get(v_c, ['id']), v_current)) ? v_currentLook : v_otherLook)])]), 'current': og_eq(og_get(v_c, ['id']), v_current), 'testid': 'item', 'block': true}, 'children': og_markup(c_7)}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/ListItem.html.twig', {'attrs': og_attrs(['data-slot', 'categories-row']), 'children': c_8}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/List.html.twig', {'tag': 'ul', 'class': og_s(v_listShape), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_9}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('compose/Container.html.twig', {'class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', (og_t(og_eq(v_density, 'compact')) ? 'py-2' : 'py-4')])), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'nav', 'attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, v_label]), 'data-layout', v_layout, 'data-slot', 'category-nav']), 'children': c_11}, with_context = false) }}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/category-nav.json
    Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon, or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes: layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
    Props (p): label, categories, current, layout, count, icon, density, tools, landmarkLabel. *}
{var $v_label = ($p['label'] ?? null)}
{var $v_categories = ($p['categories'] ?? null)}
{var $v_current = ($p['current'] ?? 'all')}
{var $v_layout = ($p['layout'] ?? 'chips')}
{var $v_count = ($p['count'] ?? 'show')}
{var $v_icon = ($p['icon'] ?? 'show')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_tools = ($p['tools'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{var $v_chipLike = og_or([og_eq($v_layout, 'chips'), og_eq($v_layout, 'toolbar')])}
{var $v_tiles = og_eq($v_layout, 'tiles')}
{var $v_linkShape = (og_t($v_chipLike) ? 'inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border' : (og_t(og_eq($v_layout, 'bar')) ? 'inline-flex items-center gap-2 -mb-px border-b px-1 py-2' : (og_t($v_tiles) ? 'flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border' : 'inline-flex w-full items-center gap-2 rounded px-3 py-2')))}
{var $v_currentLook = (og_t($v_chipLike) ? 'bg-primary text-primary-foreground' : (og_t(og_eq($v_layout, 'bar')) ? 'border-foreground font-semibold' : (og_t($v_tiles) ? 'inset-ring-foreground font-semibold' : 'bg-muted font-semibold')))}
{var $v_otherLook = (og_t(og_eq($v_layout, 'bar')) ? 'border-transparent' : '')}
{var $v_listShape = (og_t(og_eq($v_layout, 'sidebar')) ? 'flex flex-col gap-2' : (og_t(og_eq($v_layout, 'bar')) ? 'flex flex-wrap gap-2 gap-x-4 border-b border-border' : (og_t($v_tiles) ? 'grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6' : 'flex flex-wrap gap-2')))}
{capture $c_11}
  {capture $c_10}
    {if og_t(og_eq($v_layout, 'toolbar'))}
      {capture $c_3}
        {=og_include('blocks/search-field.latte', ['p' => ['value' => og_coalesce([og_get($v_tools, ['query']), '']), 'label' => og_coalesce([og_get($v_tools, ['search']), '']), 'placeholder' => og_get($v_tools, ['search'])]])|noescape}
        {capture $c_1}
          {=og_include('ui/select/SelectOption.latte', ['value' => 'sort', 'selected' => true, 'attrs' => og_attrs(['label', og_get($v_tools, ['sortValue'])])])|noescape}
        {/capture}
        {=og_include('compose/Select.latte', ['name' => 'sort', 'size' => 'sm', 'class' => 'w-48', 'attrs' => og_attrs(['aria-label', og_get($v_tools, ['sort'])]), 'children' => (string) $c_1])|noescape}
        {capture $c_2}
          {=og_text(og_get($v_tools, ['shown']))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
      {/capture}
      {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'class' => 'mb-4 flex-wrap', 'attrs' => og_attrs(['data-slot', 'toolbar']), 'children' => (string) $c_3])|noescape}
    {/if}
    {if og_t(og_gt(og_len($v_categories), 0))}
      {capture $c_9}
        {foreach og_l($v_categories) as $v_c}
          {capture $c_8}
            {capture $c_7}
              {if og_t(og_eq($v_icon, 'show'))}
                {if og_t($v_tiles)}
                  {capture $c_4}
                    {=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_c, ['icon'])), 'size' => 20])|noescape}
                  {/capture}
                  {=og_include('compose/Inline.latte', ['class' => 'flex size-10 items-center justify-center rounded bg-muted', 'children' => (string) $c_4])|noescape}
                {else}
                  {=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_c, ['icon'])), 'size' => 16])|noescape}
                {/if}
              {/if}
              {capture $c_5}
                {=og_text(og_get($v_c, ['name']))}
              {/capture}
              {=og_include('compose/Inline.latte', ['children' => (string) $c_5])|noescape}
              {if og_t(og_eq($v_count, 'show'))}
                {capture $c_6}
                  {=og_text(og_str(og_get($v_c, ['count'])))}
                {/capture}
                {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_6])|noescape}
              {/if}
            {/capture}
            {=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_c, ['href']), 'className' => og_cnv([og_cnv(['text-sm', $v_linkShape, (og_t(og_eq(og_get($v_c, ['id']), $v_current)) ? $v_currentLook : $v_otherLook)])]), 'current' => og_eq(og_get($v_c, ['id']), $v_current), 'testid' => 'item', 'block' => true], 'children' => og_markup($c_7)])|noescape}
          {/capture}
          {=og_include('compose/ListItem.latte', ['attrs' => og_attrs(['data-slot', 'categories-row']), 'children' => (string) $c_8])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/List.latte', ['tag' => 'ul', 'class' => og_s($v_listShape), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_9])|noescape}
    {/if}
  {/capture}
  {=og_include('compose/Container.latte', ['class' => og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', (og_t(og_eq($v_density, 'compact')) ? 'py-2' : 'py-4')])), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'nav', 'attrs' => og_attrs(['aria-label', og_coalesce([$v_landmarkLabel, $v_label]), 'data-layout', $v_layout, 'data-slot', 'category-nav']), 'children' => (string) $c_11])|noescape}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add category-nav
blocks/category-nav.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/category-nav.json
    Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon, or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes: layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.
    Props (p): label, categories, current, layout, count, icon, density, tools, landmarkLabel. -#}
{%- set v_label = og_def(p['label'], none) -%}
{%- set v_categories = og_def(p['categories'], none) -%}
{%- set v_current = og_def(p['current'], 'all') -%}
{%- set v_layout = og_def(p['layout'], 'chips') -%}
{%- set v_count = og_def(p['count'], 'show') -%}
{%- set v_icon = og_def(p['icon'], 'show') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_tools = og_def(p['tools'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set v_chipLike = og_or([og_eq(v_layout, 'chips'), og_eq(v_layout, 'toolbar')]) -%}
{%- set v_tiles = og_eq(v_layout, 'tiles') -%}
{%- set v_linkShape = ('inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border' if og_t(v_chipLike) else ('inline-flex items-center gap-2 -mb-px border-b px-1 py-2' if og_t(og_eq(v_layout, 'bar')) else ('flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border' if og_t(v_tiles) else 'inline-flex w-full items-center gap-2 rounded px-3 py-2'))) -%}
{%- set v_currentLook = ('bg-primary text-primary-foreground' if og_t(v_chipLike) else ('border-foreground font-semibold' if og_t(og_eq(v_layout, 'bar')) else ('inset-ring-foreground font-semibold' if og_t(v_tiles) else 'bg-muted font-semibold'))) -%}
{%- set v_otherLook = ('border-transparent' if og_t(og_eq(v_layout, 'bar')) else '') -%}
{%- set v_listShape = ('flex flex-col gap-2' if og_t(og_eq(v_layout, 'sidebar')) else ('flex flex-wrap gap-2 gap-x-4 border-b border-border' if og_t(og_eq(v_layout, 'bar')) else ('grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6' if og_t(v_tiles) else 'flex flex-wrap gap-2'))) -%}
{%- set c_11 -%}
  {%- set c_10 -%}
    {%- if og_t(og_eq(v_layout, 'toolbar')) %}
      {%- set c_3 -%}
        {{ og_include('blocks/search-field.html.j2', {'p': {'value': og_coalesce([og_get(v_tools, ['query']), '']), 'label': og_coalesce([og_get(v_tools, ['search']), '']), 'placeholder': og_get(v_tools, ['search'])}}) }}
        {%- set c_1 -%}
          {{ og_include('ui/select/select-option.html.j2', {'p': {'Value': 'sort', 'Selected': true, 'Attrs': og_attrs(['label', og_get(v_tools, ['sortValue'])])}}) }}
        {%- endset -%}
        {{ og_include('compose/select.html.j2', {'p': {'Name': 'sort', 'Size': 'sm', 'Class': 'w-48', 'Attrs': og_attrs(['aria-label', og_get(v_tools, ['sort'])])}, 'children': c_1}) }}
        {%- set c_2 -%}
          {{ og_text(og_get(v_tools, ['shown'])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
      {%- endset -%}
      {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Class': 'mb-4 flex-wrap', 'Attrs': og_attrs(['data-slot', 'toolbar'])}, 'children': c_3}) }}
    {%- endif %}
    {%- if og_t(og_gt(og_len(v_categories), 0)) %}
      {%- set c_9 -%}
        {%- for v_c in og_l(v_categories) %}
          {%- set c_8 -%}
            {%- set c_7 -%}
              {%- if og_t(og_eq(v_icon, 'show')) %}
                {%- if og_t(v_tiles) %}
                  {%- set c_4 -%}
                    {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_c, ['icon'])), 'Size': 20}}) }}
                  {%- endset -%}
                  {{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex size-10 items-center justify-center rounded bg-muted'}, 'children': c_4}) }}
                {%- else %}
                  {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_c, ['icon'])), 'Size': 16}}) }}
                {%- endif %}
              {%- endif %}
              {%- set c_5 -%}
                {{ og_text(og_get(v_c, ['name'])) }}
              {%- endset -%}
              {{ og_include('compose/inline.html.j2', {'p': {}, 'children': c_5}) }}
              {%- if og_t(og_eq(v_count, 'show')) %}
                {%- set c_6 -%}
                  {{ og_text(og_str(og_get(v_c, ['count']))) }}
                {%- endset -%}
                {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_6}) }}
              {%- endif %}
            {%- endset -%}
            {{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_c, ['href']), 'className': og_cnv([og_cnv(['text-sm', v_linkShape, (v_currentLook if og_t(og_eq(og_get(v_c, ['id']), v_current)) else v_otherLook)])]), 'current': og_eq(og_get(v_c, ['id']), v_current), 'testid': 'item', 'block': true}, 'children': og_markup(c_7)}) }}
          {%- endset -%}
          {{ og_include('compose/list-item.html.j2', {'p': {'Attrs': og_attrs(['data-slot', 'categories-row'])}, 'children': c_8}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': og_s(v_listShape), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_9}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('compose/container.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', ('py-2' if og_t(og_eq(v_density, 'compact')) else 'py-4')])), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'nav', 'Attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, v_label]), 'data-layout', v_layout, 'data-slot', 'category-nav'])}, 'children': c_11}) }}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon, or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes: layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.

Props of CategoryNav
PropTypeDefault Description
label (required)string-accessible name of the navigation
categories (required)Category[]-
current string"all"id of the current category
layout "chips" | "bar" | "sidebar" | "tiles" | "toolbar""chips"
count "show" | "hide""show"
icon "show" | "hide""show"
density "default" | "compact""default"
tools CategoryTools-the toolbar layout: labels of the search, the sort and the number shown
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one

Used in