BSelect

index.tsx
import React from 'react';
import BSelect from '@ui/BSelect';
import EntityAPI from '@api/EntityAPI';

const MyComponent: React.FC = () => {
	const [selected, setSelected] = useState<number | null>(null);

	return (
		<>
			// template
			<BSelect
				value={selected}
				getMethod={EntityAPI.getList}
				label='Select entity'
				dataTestId='EntityName'
				multiple={false}
				disabled={false}
				reduceElemName={(elem) => elem.name}
				reduceListItem={(elem) => (
					<span>{ elem.name }</span>
				)}
				reduceValue={(elem) => elem.id}
				searchQueryParam='name'
				onChange={(e) => setSelected(e)}
			/>
		</>
	);
}

BSelect props

IBSelectProps<T, V>

Last updated