Agent gallery
AI agent template marketplace with team filter chips, search by agent or app, ratings, install counts and one-click install.
pnpm dlx shadcn@latest add @haze/agent-gallery---
import { Bot, Check, Download, Search, Star } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
interface AgentTemplate {
id: string;
name: string;
team: "Engineering" | "Sales" | "Support" | "Marketing" | "Ops";
rating: string;
installs: string;
apps: string[];
summary: string;
}
interface Props {
id?: string;
heading?: string;
templates?: AgentTemplate[];
class?: string;
}
const {
id = "haze-agent-gallery",
heading = "Agent template gallery",
templates = [
{ id: "ag1", name: "PR Review Companion", team: "Engineering", rating: "4.9", installs: "12.4k", apps: ["GitHub", "Linear"], summary: "Reviews pull requests for accessibility, token compliance and missing E2E assertions." },
{ id: "ag2", name: "Inbound Lead Qualifier", team: "Sales", rating: "4.8", installs: "8.1k", apps: ["HubSpot", "Slack"], summary: "Enriches new signups, computes ICP fit scores and posts high-intent alerts." },
{ id: "ag3", name: "Tier-1 Ticket Resolver", team: "Support", rating: "4.9", installs: "15.2k", apps: ["Zendesk", "Notion"], summary: "Answers common billing and onboarding questions with cited docs links." },
{ id: "ag4", name: "Changelog Storyteller", team: "Marketing", rating: "4.7", installs: "5.3k", apps: ["GitHub", "Slack"], summary: "Turns merged pull requests into customer-ready release notes every week." },
{ id: "ag5", name: "Invoice Anomaly Watcher", team: "Ops", rating: "4.8", installs: "4.6k", apps: ["Stripe", "Gmail"], summary: "Flags unexpected vendor invoice spikes and routes approvals to finance." },
],
class: className,
} = Astro.props;
const teams = ["All", "Engineering", "Sales", "Support", "Marketing", "Ops"] as const;
---
<section aria-labelledby={`${id}-title`} data-haze-agent-gallery class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
<div class="mx-auto max-w-5xl rounded-2xl border border-border bg-card p-5 sm:p-6">
<header class="flex flex-col gap-4 border-b border-border pb-4 sm:flex-row sm:items-center sm:justify-between">
<div class="flex items-center gap-2.5">
<span class="grid size-8 place-items-center rounded-lg border border-frame bg-muted text-muted-foreground" aria-hidden="true">
<Bot class="size-4" />
</span>
<div>
<h2 id={`${id}-title`} class="text-base/6 font-semibold tracking-tight text-foreground">{heading}</h2>
<p class="text-xs/5 text-muted-foreground">Install pre-built team agents with scoped app permissions.</p>
</div>
</div>
<div class="relative w-full sm:w-64">
<Search class="pointer-events-none absolute top-1/2 left-3 size-3.5 -translate-y-1/2 text-muted-foreground" aria-hidden="true" />
<label for={`${id}-search`} class="sr-only">Search agent templates</label>
<input id={`${id}-search`} data-ag-search type="search" placeholder="Search by agent or app…" class="h-9 w-full rounded-lg border border-frame-input bg-field pr-3 pl-8 text-xs text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/24 focus-visible:outline-hidden transition-[color,background-color,border-color,box-shadow] duration-150 hover:border-frame-foreground" />
</div>
</header>
<div role="group" aria-label="Filter by team" class="mt-4 flex flex-wrap gap-1.5">
{
teams.map((team, idx) => (
<button
type="button"
data-ag-team={team}
aria-pressed={idx === 0 ? "true" : "false"}
class="inline-flex h-8 cursor-pointer items-center rounded-lg border border-frame bg-field px-3 text-xs font-medium text-muted-foreground transition-colors duration-150 hover:text-foreground aria-pressed:border-border-strong aria-pressed:bg-accent aria-pressed:text-foreground focus-visible:outline-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
>
{team}
</button>
))
}
</div>
<ul role="list" class="mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
{
templates.map((tpl) => (
<li
data-ag-card
data-team={tpl.team}
data-search={`${tpl.name} ${tpl.team} ${tpl.apps.join(" ")} ${tpl.summary}`.toLowerCase()}
class="flex flex-col justify-between rounded-xl border border-border bg-muted/40 p-4 transition-colors duration-150 hover:border-border-strong"
>
<div>
<div class="flex items-center justify-between gap-2">
<span class="rounded-md border border-border bg-card px-2 py-0.5 text-[0.6875rem] font-medium text-muted-foreground">{tpl.team}</span>
<span class="inline-flex items-center gap-1 font-mono text-[0.6875rem] text-muted-foreground tabular-nums">
<Star class="size-3 text-muted-foreground" aria-hidden="true" />
{tpl.rating} · {tpl.installs}
</span>
</div>
<h3 class="mt-2.5 text-sm/5 font-semibold text-foreground">{tpl.name}</h3>
<p class="mt-1 text-xs/5 text-pretty text-muted-foreground">{tpl.summary}</p>
</div>
<div class="mt-4 flex items-center justify-between gap-2 border-t border-border pt-3">
<div class="flex flex-wrap gap-1">
{tpl.apps.map((app) => <span class="rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[0.625rem] text-muted-foreground">{app}</span>)}
</div>
<button
type="button"
data-ag-install={tpl.name}
class="inline-flex h-8 shrink-0 cursor-pointer items-center gap-1 rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75"
>
<Download class="size-3.5" aria-hidden="true" />
Install
</button>
</div>
</li>
))
}
</ul>
<p data-ag-status role="status" class="mt-4 min-h-4 text-xs/4 text-muted-foreground"></p>
</div>
</section>
<script>
function initAgentGalleries() {
document.querySelectorAll<HTMLElement>("[data-haze-agent-gallery]").forEach((root) => {
if (root.hasAttribute("data-enhanced")) return;
root.setAttribute("data-enhanced", "");
const search = root.querySelector<HTMLInputElement>("[data-ag-search]");
const status = root.querySelector<HTMLElement>("[data-ag-status]");
let activeTeam = "All";
const filter = () => {
const q = (search?.value ?? "").trim().toLowerCase();
root.querySelectorAll<HTMLElement>("[data-ag-card]").forEach((card) => {
const okTeam = activeTeam === "All" || card.dataset.team === activeTeam;
const okText = !q || (card.dataset.search ?? "").includes(q);
card.hidden = !(okTeam && okText);
});
};
search?.addEventListener("input", filter);
root.querySelectorAll<HTMLButtonElement>("[data-ag-team]").forEach((btn) => {
btn.addEventListener("click", () => {
activeTeam = btn.dataset.agTeam ?? "All";
root.querySelectorAll<HTMLButtonElement>("[data-ag-team]").forEach((b) => b.setAttribute("aria-pressed", String(b === btn)));
filter();
});
});
root.querySelectorAll<HTMLButtonElement>("[data-ag-install]").forEach((btn) => {
btn.addEventListener("click", () => {
btn.textContent = "Installed";
btn.disabled = true;
if (status) status.textContent = `Installed "${btn.dataset.agInstall}" into workspace.`;
});
});
});
}
initAgentGalleries();
document.addEventListener("astro:page-load", initAgentGalleries);
</script>When to use
- Offering a searchable catalog of pre-built workspace agents grouped by team
- Showing required app integrations and ratings before installing an agent template
When not to use
- Configuring a custom agent from scratch with system instructions; use agent-builder
Installation
Add the Haze registry to components.json once, then install Agent gallery with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/agent-gallerynpx shadcn@latest add @haze/agent-galleryyarn dlx shadcn@latest add @haze/agent-gallerybunx --bun shadcn@latest add @haze/agent-galleryFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | "haze-agent-gallery" | Unique prefix for search label and heading IDs. |
| heading | string | "Agent template gallery" | Marketplace heading. |
| templates | AgentTemplate[] | 5 team templates | Agent templates with team, rating, installs, apps and summary. |
| class | string | – | Extra classes on the outer section. |
Keyboard interactions
- Tab
- Move across search input, team filter buttons and template Install buttons
- EnterSpace
- Filter templates by team or install a template into the workspace
Accessibility
- Team filter buttons expose aria-pressed and work alongside the labelled search field.
- Installing a template disables the button and announces confirmation in a polite role="status" element.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI block "Agent gallery" with `npx shadcn@latest add @haze/agent-gallery`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AgentGallery from "@/components/haze/blocks/agent-gallery.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/agent-gallery.md
Customize with real content
Adapt the Haze agent-gallery block for our product. Replace the demo values of these props with our real content: id, heading, templates, class. Keep the layout, the heading level rules and these accessibility details: Team filter buttons expose aria-pressed and work alongside the labelled search field. Installing a template disables the button and announces confirmation in a polite role="status" element. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using agent-gallery, check it fits: use it when offering a searchable catalog of pre-built workspace agents grouped by team; showing required app integrations and ratings before installing an agent template. Avoid it when configuring a custom agent from scratch with system instructions; use agent-builder. Alternatives: @haze/agent-builder, @haze/gallery-project-grid.
Dependencies
- npm: @lucide/astro
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.