# ActionLink (action-link)

> A text anchor with an optional arrow and visible hover and keyboard focus.

- Entry: component
- Category: UI
- Preview capabilities: none (still preview)
- Runtime: React
- Needs Remotion: no
- QA page: https://jbm-ui.bns.studio/c/action-link
- JSON: https://jbm-ui.bns.studio/catalog/action-link.json
- Registry item: https://jbm-ui.bns.studio/r/action-link.json (source code in files[].content)

## Install

```sh
npx shadcn@latest add @jbm/action-link
```

Also installs @jbm/tokens (registry dependencies install automatically).

## Required setup

1. Add the `@jbm` registry to components.json (keep any entries already there):

   ```json
   {
     "registries": {
       "@jbm": "https://jbm-ui.bns.studio/r/{name}.json"
     }
   }
   ```

2. Map `@/*` to `./src/*` in tsconfig.json `compilerOptions.paths`, so `@/jbm/…` imports resolve to src/jbm/.

## Files

Each file's source code is in the registry item JSON (https://jbm-ui.bns.studio/r/action-link.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/ui/action-link.tsx` | `src/jbm/ui/action-link.tsx` | `@/jbm/ui/action-link` |

## API

### `ActionLink` (component)

A real <a> (all anchor attributes and the ref pass through) in Geist 18px bold with a 1px underline. On hover or keyboard focus it turns vermilion with a 2px underline; caller onMouseEnter, onMouseLeave, onFocus, and onBlur handlers still run. An optional decorative ↗ arrow follows the text.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `arrow` | `boolean` | `true` | Shows the trailing ↗ arrow (aria-hidden). Set false for a plain underlined link. |

Also accepts React.ComponentPropsWithRef<"a">.

## Stage

fluid: Inline-flex, sized by its text up to 100% of the container: one line is 18px × 1.4 plus 6px padding above and below (about 37px); long text wraps anywhere and adds lines.

## Examples

### Link with and without the arrow

```tsx
import { ActionLink } from "@/jbm/ui/action-link"

<ActionLink href="/ideas">Explora las ideas</ActionLink>
<ActionLink href="/historia" arrow={false}>Lee la historia completa</ActionLink>
```

## QA

- Hover and Tab to each link: both switch to vermilion with a thicker underline and a visible focus outline offset 5px, then revert on leave or blur.
- Check that the arrow is not read by screen readers and does not wrap onto its own line apart from the text.
- Check a long link text on a narrow screen: it wraps without overflowing.

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.md)

Installed by:

- [IndexRow (index-row)](https://jbm-ui.bns.studio/catalog/index-row.md)

## More

- [llms.txt](https://jbm-ui.bns.studio/llms.txt): index of every item
- [catalog.json](https://jbm-ui.bns.studio/catalog.json): every item as JSON
- [Agent contract](https://jbm-ui.bns.studio/docs/agent-contract.md): what each field means
