Platform docs
Auth, users, webhooks & more
Info:
This is beta documentation for Stream Video React SDK v2. For the latest stable version, see the latest version (v1).

Dropdown select

The DropDownSelect utility component can be used to simply create a dropdown select component.

DropDownSelect is a controlled component: it does not keep track of the selected option itself. Pass the current selection through selectedIndex and selectedLabel, and update it in handleSelect.

import { useState } from "react";
import {
  DropDownSelect,
  DropDownSelectOption,
} from "@stream-io/video-react-sdk";

const options = ["Low", "Medium", "High"];

export const QualitySelector = () => {
  const [selectedIndex, setSelectedIndex] = useState(0);

  return (
    <DropDownSelect
      selectedIndex={selectedIndex}
      selectedLabel={options[selectedIndex]}
      handleSelect={setSelectedIndex}
    >
      {options.map((option, index) => (
        <DropDownSelectOption
          key={option}
          label={option}
          selected={index === selectedIndex}
        />
      ))}
    </DropDownSelect>
  );
};

Props

Name Description Type
icon Icon to be shown next to the label of the selected item string | undefined
selectedLabel Label of the currently selected option string
selectedIndex Index of the currently selected option number
handleSelect Called with the index of the option the user picked (index: number) => void
children DropDownSelectOption ReactElement<DropDownSelectOptionProps> | ReactElement<DropDownSelectOptionProps[]>

You can provide the DropDownSelectOption as a child to the DropDownSelect

Name Description Type
label string
selected boolean | undefined
icon string