使用:https://react-select.com/home我一直在尝试以下想法的变体:
const hex = 'f2bc';
const char = unescape('%u' + hex);
<Select
defaultValue={ label: char, value: 'some-value'}
...={...}/>
编辑:这是上述尝试的结果:The font awesome icon is not being found
react-select
很灵活,允许PropTypes.node
通过label
option。
font-awesome
图标can be used with className应用于HTMLSpan元素,例如
const labelWithIcon = <span className="fas fa-stroopwafel" />
<Select defaultValue={ label: labelWithIcon, value: 'some-value'} />