> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beyondwords.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Next Seconds Button

> Seeks forward by a fixed number of seconds.

> [tab] Preview

> [tab] Code
>
> ```js NextSecondsButton.js theme={null}
> import { newEvent } from "@/lib/newEvent";
> import { seekForwardSvg } from "@/registry/html/icons";
> import { BwPlayerConsumer } from "@/registry/html/PlayerProvider";
>
> export class BwNextSecondsButton extends BwPlayerConsumer {
>   _btn = null;
>
>   constructor() {
>     super();
>     this._btn = document.createElement("button");
>     this._btn.addEventListener("click", () => {
>       if (!this._player) return;
>       this._player.onEvent(
>         newEvent({
>           type: "PressedSeekAhead",
>           description: "The seek ahead button was pressed.",
>           seconds: this._seconds,
>         }),
>       );
>     });
>   }
>
>   get _seconds() {
>     const seconds = Number(this.dataset.seconds);
>     return Number.isFinite(seconds) && seconds > 0 ? seconds : 10;
>   }
>
>   connectedCallback() {
>     super.connectedCallback();
>     this._btn.setAttribute("aria-label", `Skip forward ${this._seconds} seconds`);
>     this._btn.innerHTML = seekForwardSvg(this._seconds, 24);
>     this.appendChild(this._btn);
>   }
> }
>
> customElements.define("bw-next-seconds-button", BwNextSecondsButton);
> ```

## Installation

```bash npm theme={null}
npx @beyondwords/cli components add next-seconds-button --html
```

```bash pnpm theme={null}
pnpm dlx @beyondwords/cli components add next-seconds-button --html
```

```bash yarn theme={null}
yarn dlx @beyondwords/cli components add next-seconds-button --html
```

```bash bun theme={null}
bunx --bun @beyondwords/cli components add next-seconds-button --html
```

## Usage

Import the modules (each calls `customElements.define`), then use the elements. Nest the button inside a `<bw-player-provider>`.

```html theme={null}
<bw-player-provider
  data-project-id="9504"
  data-content-id="ba00ef51-03ac-4a85-8b98-e45c957e8ef8"
  data-show-user-interface="false"
>
  <bw-next-seconds-button data-seconds="10"></bw-next-seconds-button>
</bw-player-provider>

<script type="module">
  import "@/registry/html/PlayerProvider";
  import "@/registry/html/NextSecondsButton";
</script>
```

`<bw-next-seconds-button>` finds its nearest
[`<bw-player-provider>`](https://docs.beyondwords.io/components/html/player-provider) ancestor. On click,
it emits a `PressedSeekAhead` event (built with
[`newEvent`](https://docs.beyondwords.io/components/html/new-event)) carrying the number of `seconds` to seek.
The `data-seconds` attribute controls both the jump distance and the label,
and defaults to `10`.

> [!WARNING]
>
> These components expect the BeyondWords player to be available as a global
> `BeyondWords` (the player UMD script). Load it before the provider connects.

## Reference

| | |
| - | - |
| **Attributes** | `data-seconds` (default `10`) |
| **Player state read** | None |
| **Events emitted** | `PressedSeekAhead` |
| **Requires** | a `<bw-player-provider>` ancestor and the player UMD global loaded |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.