We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select
all
No response
import React from 'react'; import { Select, Checkbox, Highlight } from '@douyinfe/semi-ui'; () => { const [inputValue, setInputValue] = useState(''); const renderOptionItem = renderProps => { const { disabled, selected, label, value, focused, className, style, onMouseEnter, onClick, empty, emptyContent, ...rest } = renderProps; const optionCls = classNames({ ['custom-option-render']: true, ['custom-option-render-focused']: focused, ['custom-option-render-disabled']: disabled, ['custom-option-render-selected']: selected, className }); const searchWords = [inputValue]; // Notice: // 1.props传入的style需在wrapper dom上进行消费,否则在虚拟化场景下会无法正常使用 // 2.选中(selected)、聚焦(focused)、禁用(disabled)等状态的样式需自行加上,你可以从props中获取到相对的boolean值 // 3.onMouseEnter、className需在wrapper dom上绑定,否则上下键盘操作时显示会有问题 return ( <div style={style} className={optionCls} onClick={() => onClick()} onMouseEnter={e => onMouseEnter()}> <Checkbox checked={selected} /> <div className="option-right"> <Highlight sourceString={label} searchWords={searchWords} /> </div> </div> ); }; const optionList = [ { value: 'abc', label: '抖音', otherKey: 0 }, { value: 'ulikecam', label: '轻颜相机', disabled: true, otherKey: 1 }, { value: 'jianying', label: '剪映', otherKey: 2 }, { value: 'toutiao', label: '今日头条', otherKey: 3 }, { value: 'ulikecam1', label: '轻颜相机1', disabled: true, otherKey: 1 }, { value: 'jianying1', label: '剪映1', otherKey: 2 }, { value: 'toutiao1', label: '今日头条1', otherKey: 3 }, { value: 'ulikecam2', label: '轻颜相机2', disabled: true, otherKey: 1 }, { value: 'jianying2', label: '剪映2', otherKey: 2 }, { value: 'toutiao2', label: '今日头条2', otherKey: 3 }, { value: 'ulikecam3', label: '轻颜相机3', disabled: true, otherKey: 1 }, { value: 'jianying3', label: '剪映3', otherKey: 2 }, { value: 'toutiao3', label: '今日头条3', otherKey: 3 }, ]; return ( <> <Select filter placeholder="多选" multiple onSearch={(v) => setInputValue(v)} dropdownClassName="components-select-demo-renderOptionItem" optionList={optionList} style={{ width: 320 }} renderOptionItem={renderOptionItem} /> </> ); };
- OS: - browser:
The text was updated successfully, but these errors were encountered:
pointhalo
No branches or pull requests
Is there an existing issue for this?
Which Component
Select
Semi Version
all
Current Behavior
Expected Behavior
Steps To Reproduce
No response
ReproducibleCode
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: