> ## 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 Segment Button

> Jumps to the next segment and emits a user interaction event.

> [tab] Preview

> [tab] Code
>
> ```jsx NextSegmentButton.jsx theme={null}
> "use client";
>
> import { newEvent } from "@/lib/newEvent";
> import { NextSegmentIcon } from "@/registry/react/Icons";
> import { usePlayer } from "@/registry/react/PlayerProvider";
>
> export function NextSegmentButton() {
>   const player = usePlayer();
>   return (
>     <button
>       type="button"
>       aria-label="Next segment"
>       onClick={() => {
>         player.onEvent(
>           newEvent({
>             type: "PressedNextSegment",
>             description: "The next segment button was pressed.",
>           }),
>         );
>       }}
>     >
>       <NextSegmentIcon size={24} />
>     </button>
>   );
> }
> ```

## Installation

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

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

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

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

## Usage

```tsx theme={null}
import { PlayerProvider } from '@/registry/react/PlayerProvider';
import { NextSegmentButton } from '@/registry/react/NextSegmentButton';

export function Player() {
  return (
    <PlayerProvider args={{ projectId: 9504, contentId: "ba00ef51-03ac-4a85-8b98-e45c957e8ef8", showUserInterface: false }}>
      <NextSegmentButton />
    </PlayerProvider>
  );
}
```

On click, the button emits a `PressedNextSegment` event on the surrounding
[`PlayerProvider`](https://docs.beyondwords.io/components/react/player-provider), built with
[`newEvent`](https://docs.beyondwords.io/components/react/new-event). The player handles the event and moves
playback to the next segment.

## Reference

| | |
| - | - |
| **Props** | None |
| **Player state read** | None |
| **Events emitted** | `PressedNextSegment` |
| **Requires** | a [`PlayerProvider`](https://docs.beyondwords.io/components/react/player-provider) ancestor |


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