# ReputationScore

**Slug:** `reputation-score`  
**Import:** `import { ReputationScore } 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

Compact inline badge showing the agent's average feedback score and total review count.

## Usage

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

## Examples

### Without Count

Hide the review count for a more minimal display.

```tsx
<ReputationScore agentRegistry="eip155:8453:0x8004...a432" agentId={888} showCount={false} />
```

### Higher Precision

Show two decimal places for more precise scores.

```tsx
<ReputationScore agentRegistry="eip155:8453:0x8004...a432" agentId={888} precision={2} />
```

## In Context

ReputationScore in a marketplace card alongside the agent's image, name, and tag cloud.

```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 />
</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). |
| `showCount` | `boolean` | no | `true` | Show/hide the inline "AVG / N reviews" label beside the score. |
| `precision` | `number` | no | `1` | Decimal places for the score display. |

## States

This component handles loading and error states internally with inline placeholders. No configuration needed.

## Reference

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