react-select#Props TypeScript Examples

The following examples show how to use react-select#Props. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Select.tsx    From ke with MIT License 6 votes vote down vote up
Select = <
  OptionType extends OptionTypeBase = { label: string; value: string },
  IsMulti extends boolean = false
>({
  components: externalComponents,
  styles,
  ...props
}: Props<OptionType, IsMulti>): JSX.Element => (
  // Это обёртка
  // eslint-disable-next-line react/jsx-props-no-spreading
  <BaseSelect components={{ ...components, ...externalComponents }} styles={modifyStyles(styles)} {...props} />
)
Example #2
Source File: MultiSelect.tsx    From crossfeed with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
MultiSelect = (
  props: Props & {
    zIndex: number;
  }
) => {
  return (
    <Select
      isMulti
      {...props}
      components={{
        DropdownIndicator,
        IndicatorSeparator: () => null
      }}
      styles={{
        container: (provided, state) => ({
          ...provided,
          maxWidth: '30rem',
          zIndex: props.zIndex
        }),
        control: (provided, state) => ({
          ...provided,
          borderColor: '#565c65',
          borderWidth: 1,
          marginTop: '0.5rem',
          minHeight: '2.5rem',
          borderRadius: 0
        })
      }}
    />
  );
}