Skip to content

Commit 5a25e49

Browse files
committed
refactor(CFormSelect): allow to add options with value=""
1 parent f0931e3 commit 5a25e49

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/coreui-react/src/components/form/CFormSelect.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Option = {
99
label?: string
1010
value?: string
1111
}
12+
1213
export interface CFormSelectProps
1314
extends CFormControlWrapperProps,
1415
Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {
@@ -102,7 +103,8 @@ export const CFormSelect = forwardRef<HTMLSelectElement, CFormSelectProps>(
102103
<option
103104
{...(typeof option === 'object' &&
104105
option.disabled && { disabled: option.disabled })}
105-
{...(typeof option === 'object' && option.value && { value: option.value })}
106+
{...(typeof option === 'object' &&
107+
option.value !== 'undefined' && { value: option.value })}
106108
key={index}
107109
>
108110
{typeof option === 'string' ? option : option.label}

0 commit comments

Comments
 (0)