github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/ui/Select.tsx (about)

     1  import React from 'react';
     2  import styles from './Select.module.scss';
     3  
     4  interface SelectProps {
     5    ariaLabel: string;
     6    className?: string;
     7    value: string;
     8    onChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
     9    name?: string;
    10    children: React.DetailedHTMLProps<
    11      React.OptionHTMLAttributes<HTMLOptionElement>,
    12      HTMLOptionElement
    13    >[];
    14    id?: string;
    15    disabled?: boolean;
    16  }
    17  
    18  export default function Select({
    19    ariaLabel,
    20    className,
    21    value,
    22    onChange,
    23    children,
    24    name,
    25    id,
    26    disabled,
    27  }: SelectProps) {
    28    return (
    29      <select
    30        id={id}
    31        disabled={disabled || false}
    32        name={name}
    33        aria-label={ariaLabel}
    34        className={`${styles.select} ${className || ''}`}
    35        value={value}
    36        onChange={onChange}
    37      >
    38        {children}
    39      </select>
    40    );
    41  }