react-select#OptionProps TypeScript Examples
The following examples show how to use
react-select#OptionProps.
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: popup-list.tsx From utopia with MIT License | 5 votes |
Option = (props: OptionProps<SelectOption>) => {
const selectOption = props.selectOption
const data: SelectOption = props.data
const onMouseUp = React.useCallback(() => {
selectOption(data)
}, [data, selectOption])
return (
<FlexRow {...props.innerProps} onMouseUp={onMouseUp} style={props.getStyles('option', props)}>
<FlexRow style={{ width: CheckboxWidth, padding: CheckboxPadding, flexShrink: 0 }}>
{props.isSelected ? '✓' : ''}
</FlexRow>
{props.data.icon == null ? null : <Icn {...props.data.icon} />}
<span style={{ paddingLeft: 8 }}>{props.children}</span>
</FlexRow>
)
}
Example #2
Source File: index.tsx From admin with MIT License | 5 votes |
Option = ({ className, ...props }: OptionProps) => {
return (
<components.Option
{...props}
className="my-1 py-0 py-0 px-2 bg-grey-0 active:bg-grey-0"
>
<div
className={`item-renderer h-full hover:bg-grey-10 py-2 px-2 cursor-pointer rounded`}
>
<div className="items-center h-full flex">
{props.data?.value !== "all" && props.data?.label !== "Select All" ? (
<>
{props.isMulti ? (
<CheckboxAdornment {...props} />
) : (
<RadioAdornment {...props} />
)}
<span className="ml-3 text-grey-90 inter-base-regular">
{props.data.label}
</span>
</>
) : (
<span className="text-grey-90 inter-base-regular">
{props.data.label}
</span>
)}
</div>
</div>
</components.Option>
)
}
Example #3
Source File: SelectField.tsx From amplication with Apache License 2.0 | 4 votes |
CustomOption = < Option, IsMulti extends boolean, Group extends GroupBase<Option> >( props: OptionProps<Option, IsMulti, Group> ) => { const { children, className, cx, isDisabled, isFocused, isSelected, innerRef, innerProps, data, } = props; const icon = ((data as unknown) as OptionItem).icon; return ( <div className={cx( { option: true, "option--is-disabled": isDisabled, "option--is-focused": isFocused, "option--is-selected": isSelected, }, className )} ref={innerRef} aria-disabled={isDisabled} {...innerProps} > {icon && <Icon icon={icon} />} {children} </div> ); }
Example #4
Source File: Dropdown.tsx From contracts-ui with GNU General Public License v3.0 | 4 votes |
function Option<T>({ children, ...props }: OptionProps<DropdownOption<T>, false>) {
return (
<components.Option {...props}>
<span>{children}</span>
{props.isSelected && <CheckIcon className="selected" />}
</components.Option>
);
}