mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
26 lines
No EOL
789 B
JavaScript
26 lines
No EOL
789 B
JavaScript
import React from 'react';
|
|
import SelectSearch from 'react-select-search';
|
|
|
|
export const CustomSelect = ({ options, value, multiple, disabled, onChange }) => {
|
|
|
|
function renderValue(valueProps) {
|
|
if(valueProps) {
|
|
return valueProps.value.split(', ').map((value) => <span {...valueProps} className="badge bg-blue-lt p-2 mx-1">{value}</span>);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="custom-select">
|
|
<SelectSearch
|
|
options={options}
|
|
printOptions="on-focus"
|
|
value={value}
|
|
renderValue={renderValue}
|
|
search={false}
|
|
onChange={onChange}
|
|
multiple={multiple}
|
|
placeholder="Select.."
|
|
/>
|
|
</div>
|
|
);
|
|
}; |