# useCaptionsOptions

Hook to build captions menu options from the player text track state

## Import

```tsx
import { useCaptionsOptions } from "@videojs/react";
```

`useCaptionsOptions` returns the currently showing caption track, the available options (starting with an `Off` option), and a `setValue` callback for wiring caption selection into a menu. It returns `null` when the [text tracks feature](https://videojs.org/docs/framework/react/reference/api/feature-text-tracks) is not configured.

**CaptionsMenu.tsx**

```tsx
import { Menu, useCaptionsOptions } from "@videojs/react";

function CaptionsMenu() {
  const captions = useCaptionsOptions();
  if (captions?.state.availability !== "available") return null;

  return (
    <Menu.RadioGroup value={captions.value} onValueChange={captions.setValue} aria-label="Captions">
      {captions.options.map((option) => (
        <Menu.RadioItem key={option.value} value={option.value} disabled={option.disabled}>
          {option.label}
          <Menu.ItemIndicator checked={option.value === captions.value} />
        </Menu.RadioItem>
      ))}
    </Menu.RadioGroup>
  );
}
```

Option labels use the track label, then language, then kind. Pass `formatTrack` to customize the visible labels. The result also exposes `showMenu`, which is `true` when more than one caption or subtitle track is available — the same threshold [CaptionsButton](https://videojs.org/docs/framework/react/reference/components/captions-button) uses to open a menu instead of toggling in `menuTrigger` mode.

See [CaptionsRadioGroup](https://videojs.org/docs/framework/react/reference/components/captions-radio-group) for the component-level pattern, and [Menu](https://videojs.org/docs/framework/react/reference/components/menu) for a complete settings menu example.

## API Reference

`useCaptionsOptions(props?): CaptionsOptionsResult | null`

### Parameters

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `props` | `{ label?: Text \| string \| ((state: CaptionsRadioGroupState) => Text \| string); formatTrack?: ((track: MediaTextTrack) => Text \| string); disabled?: boolean }` | — | Optional `label`, `formatTrack`, and `disabled` overrides. |

### Return Value

| Property | Type |
| --- | --- |
| `state` | `{ subtitlesShowing: boolean; label: Text \| string; value: string; options: readonly Option[]; disabled: boolean; hidden: boolean; availability: 'available' \| 'unavailable' }` |
| `label` | `string` |
| `value` | `string` |
| `selectedLabel` | `string` |
| `options` | `CaptionsOption[]` |
| `disabled` | `boolean` |
| `hidden` | `boolean` |
| `showMenu` | `boolean` |
| `setValue` | `((value: string) => void)` |

---

React documentation: https://videojs.org/docs/framework/react/llms.txt
All documentation: https://videojs.org/llms.txt
