# TagCloud

**Slug:** `tag-cloud`  
**Import:** `import { TagCloud } from "@p4n/erc8004-ui"`

> **NOTE — unofficial library.** `@p4n/erc8004-ui` is an independent, community-built project. It is not affiliated with, maintained by, or endorsed by the authors of ERC-8004. It reads the standard's on-chain data through public subgraphs; it does not speak for the standard.

## Description

Weighted tag pills showing the agent's most frequent feedback tags. Pill size reflects mention frequency across all feedback entries.

## Usage

```tsx
import { TagCloud } from "@p4n/erc8004-ui"
<TagCloud agentRegistry="eip155:8453:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432" agentId={888} />
```

## Examples

### Top 5 Tags

Limit to the 5 most frequent tags.

```tsx
<TagCloud agentRegistry="eip155:8453:0x8004...a432" agentId={888} maxTags={5} />
```

### Minimum 3 Occurrences

Only show tags mentioned at least 3 times to filter out noise.

```tsx
<TagCloud agentRegistry="eip155:8453:0x8004...a432" agentId={888} minOccurrences={3} />
```

## In Context

TagCloud in a marketplace card alongside agent identity and score.

```tsx
<AgentProvider agentRegistry="eip155:8453:0x8004...a432" agentId={888}>
  <div className="flex items-center gap-3">
    <AgentImage />
    <div className="flex min-w-0 flex-1 items-center justify-between gap-3">
      <AgentName />
      <ReputationScore />
    </div>
  </div>
  <TagCloud maxTags={5} />
</AgentProvider>
```

## API Reference

| Prop | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `agentRegistry` | `string` | no | — | Agent registry in the format "eip155:{chainId}:{contractAddress}". Required unless inside an <AgentProvider>. |
| `agentId` | `number` | no | — | ERC-721 token ID of the agent. Required unless inside an <AgentProvider>. |
| `className` | `string` | no | — | Optional CSS classes merged onto the component root for layout, spacing, or custom styling (e.g. Tailwind). |
| `maxTags` | `number` | no | `20` | Maximum number of tags shown. |
| `minOccurrences` | `number` | no | `1` | Minimum mention count for a tag to appear. |
| `headingLevel` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | no | `3` | Heading level for this component's title. The default is the level it was previously hardcoded to, so leaving it alone renders exactly as before. Set it to keep the component from breaking the surrounding page's heading order. |

## States

This component handles loading, error, empty, and not-found states internally. A skeleton placeholder is shown while fetching, an error message with details appears if the Subgraph is unreachable, and a short message is displayed when no data exists for this agent.

## Reference

- Live preview & full docs: https://erc8004-ui.vercel.app/docs/components/tag-cloud
- Markdown source: https://erc8004-ui.vercel.app/docs/components/tag-cloud.md
