# Scroll To Top · Pro

A back-to-top button that appears once you've scrolled, with a ring that fills as you read down. Works on the page or any scrolling container.

This is a Charcoal UI Pro component. Its source and examples are available with a Pro seat: https://charcoalui.com/pricing

## With a Pro seat

1. Add the registry to components.json:

```json
{
  "registries": {
    "@charcoal": {
      "url": "https://charcoalui.com/r/{name}.json",
      "headers": {
        "Authorization": "Bearer ${CHARCOAL_LICENSE_KEY}"
      }
    }
  }
}
```

2. Copy your licence key from https://charcoalui.com/dashboard and put it in .env.local as CHARCOAL_LICENSE_KEY, then:

```bash
npx shadcn@latest add @charcoal/scroll-to-top
```

To read Pro source through this MCP server, reconnect it with the header "Authorization: Bearer <licence key>".

## API — Scroll To Top
| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `container` | `RefObject<HTMLElement>` | — | Defaults to the page. |
| `threshold` | `number` | `240` | Px before it shows. |
| `className` | `string` | — |  |

See it live: https://charcoalui.com/docs/components/scroll-to-top