Mat*_*att 5 font-awesome reactjs react-select
使用:https : //react-select.com/home我一直在尝试以下想法的变体:
const hex = 'f2bc';
const char = unescape('%u' + hex);
<Select
defaultValue={ label: char, value: 'some-value'}
...={...}/>
Run Code Online (Sandbox Code Playgroud)
这是上述尝试的结果:
react-select很灵活,允许PropTypes.node传递label选项。
font-awesome图标可以与应用于 HTMLSpan 元素的className 一起使用,例如
const labelWithIcon = <span className="fas fa-stroopwafel" />
<Select defaultValue={{ label: labelWithIcon, value: 'some-value' }} />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6569 次 |
| 最近记录: |