Function
NativeSelect
({
className,
id,
name,
required,
label,
defaultValue,
value,
disabled = false,
icon,
onChange,
onKeyDown,
options,
theme,
style,
}: Props)
Source from the content-addressed store, hash-verified
| 26 | } |
| 27 | |
| 28 | function NativeSelect({ |
| 29 | className, |
| 30 | id, |
| 31 | name, |
| 32 | required, |
| 33 | label, |
| 34 | defaultValue, |
| 35 | value, |
| 36 | disabled = false, |
| 37 | icon, |
| 38 | onChange, |
| 39 | onKeyDown, |
| 40 | options, |
| 41 | theme, |
| 42 | style, |
| 43 | }: Props) { |
| 44 | return ( |
| 45 | <> |
| 46 | {label && <Label htmlFor={id}>{label}</Label>} |
| 47 | <div |
| 48 | className={classNames(className, styles.container, { |
| 49 | [styles.blue]: theme === 'blue', |
| 50 | [styles.gray]: theme === 'gray', |
| 51 | [styles.disabled]: disabled, |
| 52 | })} |
| 53 | > |
| 54 | {icon && <div className={styles.icon}>{icon}</div>} |
| 55 | <select |
| 56 | className={styles.select} |
| 57 | id={id} |
| 58 | style={style} |
| 59 | name={id || name} |
| 60 | required={required} |
| 61 | defaultValue={defaultValue} |
| 62 | value={value} |
| 63 | disabled={disabled} |
| 64 | onChange={onChange} |
| 65 | onKeyDown={onKeyDown} |
| 66 | > |
| 67 | {options.map((option: Option, index: number) => ( |
| 68 | <option key={`${option.value}-${index}`} value={option.value}> |
| 69 | {option.label} |
| 70 | </option> |
| 71 | ))} |
| 72 | </select> |
| 73 | </div> |
| 74 | </> |
| 75 | ); |
| 76 | } |
| 77 | |
| 78 | export default NativeSelect; |
Callers
nothing calls this directly
Tested by
no test coverage detected