# Mention pill

A mention inside text, the `@` and a name on a ground of its own, that never reads as an author.

Live variants: https://design.arcadia.is/components/mention-pill

```tsx
import { MentionPill } from "@arcadia/ui";
```

```tsx
import { useState } from "react";
import { Ask, MentionPill, agentMentionTone } from "@arcadia/ui";

function Message() {
  const [picked, setPicked] = useState(false);
  return (
    <p {...sx("cmp-prose", cmp.prose)}>
      Ask <MentionPill label="Bud" tone={agentMentionTone(MentionPillBUD)} picture={{ avatar: MentionPillBUD }}
        you={picked ? "tinted" : false} aria-pressed={picked} onClick={() => setPicked(!picked)} /> to
      read <MentionPill label="src/billing/tax.ts" /> and
      the <MentionPill label="docs/" /> folder, then compare it with
      <MentionPill label="Fix smoke e2e" /> in
      <MentionPill label="act" tone="hue-green" />, following
      <MentionPill label="repo-hygiene" />.
    </p>
  );
}
```

## Accessibility

The pill reads as the text holds it: the `@` and the name. A pill with `onClick` is a real button, so it takes focus and Enter; with `href` it is the link itself, one stop, heard as a link. A face is drawn for the eye (`aria-hidden`), so a reader hears the name once. A muted pill keeps its name. Its tooltip says the target no longer exists.

## API reference

### MentionPill

- `label` (`string`, required): The target's name, as the text reads it after its `@`.
- `tone` (`MentionPillTone`, default `"neutral"`)
- `muted` (`boolean`): The target no longer exists: the pill steps down and says so in its tooltip.
- `picture` (`{ avatar: AgentAvatarValue; photoSrc?: string } | { src: string }`): The face before the `@`, at the line's height: an agent's stored avatar and a photo's still (never the animated one), or a picture of its own (an app's icon), whose pill reads as one without it when it fails to load. A muted pill draws none.
- `you` (`boolean | "tinted"`, default `false`)
- `href` (`string`): Its target's page (a profile): the pill is then that link.
- `linkStyle` (`"chip"`)
- `onClick` (`(e: MouseEvent<HTMLElement>) => void`): Opens the target. The pill renders as a button; without it, a span.
- `rootStyle` (`RootStyle<MentionPillKnobs>`): Typed StyleX override: layout and the `--mention-pill-*` knobs.

Rest props go to `HTMLAttributes<HTMLElement>`.
