DDBS UI
collections

Ink Category Strip

A strip of illustrated category buttons: the active sketch lifts with an underline, and pressing it again clears the selection.

npx shadcn@latest add https://ui.develop-better-solutions.com/r/ink-category-strip.json
Fullscreen

Usage

ink-category-strip-example.tsx
"use client";

import { useState } from "react";
import { InkCategoryStrip } from "@dbs/ui";

/** Simple pen-and-ink style sketches drawn as inline SVG data URIs so the preview needs no files. */
const sketch = (body: string): string =>
  `data:image/svg+xml;utf8,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 90" fill="none" stroke="#111" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`,
  )}`;

const CATS = [
  { id: "eggs", label: "Eggs", count: 6, image: sketch('<ellipse cx="45" cy="52" rx="20" ry="26"/><ellipse cx="78" cy="58" rx="18" ry="23"/>') },
  { id: "bread", label: "Bread", count: 4, image: sketch('<path d="M20 60c0-22 18-34 40-34s40 12 40 34z"/><path d="M40 40l8 14M60 36l8 18M80 40l8 14"/>') },
  { id: "meat", label: "Meat", count: 5, image: sketch('<path d="M25 55c0-18 18-30 40-28 18 2 30 14 28 28-2 12-20 18-40 16-18-2-28-6-28-16z"/><circle cx="70" cy="48" r="7"/>') },
  { id: "vinegar", label: "Vinegar", count: 3, image: sketch('<path d="M48 20h24v14l12 40H36l12-40z"/><path d="M42 54h36"/>') },
  { id: "quail", label: "Quail eggs", count: 4, image: sketch('<ellipse cx="42" cy="56" rx="11" ry="15"/><ellipse cx="62" cy="58" rx="11" ry="15"/><ellipse cx="82" cy="56" rx="11" ry="15"/>') },
  { id: "chicken", label: "Chicken", count: 3, image: sketch('<path d="M30 62c0-20 16-30 34-30 14 0 26 8 26 22 0 14-14 22-32 22-16 0-28-4-28-14z"/><path d="M84 40l10-8"/>') },
];

export default function InkCategoryStripExample() {
  const [active, setActive] = useState("");
  return (
    <div className="w-full max-w-5xl">
      <InkCategoryStrip categories={CATS} active={active} onSelect={setActive} />
    </div>
  );
}