How to use the react-select.components.MultiValue function in react-select

To help you get started, we’ve selected a few react-select examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Graylog2 / graylog2-server / graylog2-web-interface / src / views / components / aggregationbuilder / SortableSelect.jsx View on Github external
const SortableSelect = ({ onChange, value, valueComponent, valueTransformer, ...remainingProps }) => {
  // eslint-disable-next-line react/prop-types
  const ValueList = ({ children, ...rest }) => (
     _onSortEnd(v, onChange, value)}
                       axis="x"
                       helperClass={`Select--multi has-value is-clearable is-searchable ${styles.draggedElement}`}
                       pressDelay={200}>
      {children}
    
  );
  const values = valueTransformer(value);
  const SortableMultiValue = SortableElement(components.MultiValue);
  const Item = (props) => {
    // eslint-disable-next-line react/prop-types
    const index = findIndex(value, v => v.field === props.data.value);
    return ;
  };
  const _components = {
    MultiValueLabel: valueComponent,
    MultiValue: Item,
    ValueContainer: ValueList,
  };
  return (
    <select value="{values}"></select>
github Mines-Paristech-Students / Portail-des-eleves / frontend / src / components / utils / forms / SelectUsers.tsx View on Github external
);
};

const MultiValueLabel = (props) =&gt; (
    
        <img alt="{`Avatar" src="{`/profile/${props.data.value}.jpg`}">
        {props.children}
    
);

const MultiValue = components.MultiValue;

export const SelectUsers = ({
    isMulti = true,
    className = "",
    ...props
}: {
    isMulti?: boolean;
    name: string;
    className?: string;
    [key: string]: any;
}) =&gt; {
    const [, meta, helpers] = useField(props);
    const { value } = meta;
    const { setValue } = helpers;

    const { data } = useBetterQuery&gt;(