# useAudioTrackOptions

Hook to build audio track menu options from the player audio track state

## Import

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

`useAudioTrackOptions` returns the currently enabled audio track, the available options, and a `setValue` callback for wiring track selection into a menu. It returns `null` when the [audio track feature](https://videojs.org/docs/framework/react/reference/api/feature-audio-track) is not configured.

**AudioMenu.tsx**

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

function AudioMenu() {
  const audioTrack = useAudioTrackOptions();
  if (audioTrack?.state.availability !== "available") return null;

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

Option labels use the track label, then language, then kind. Pass `formatTrack` to customize the visible labels.

See [AudioTrackRadioGroup](https://videojs.org/docs/framework/react/reference/components/audio-track-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

`useAudioTrackOptions(props?): AudioTrackOptionsResult | null`

### Parameters

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

### Return Value

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

---

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