Skip to content

CFormSelect is missing "selected" prop #447

@iamjono

Description

@iamjono

In CFormSelect.tsx it refers to "selected" booleanL
Line 7-12

type Option = {
  disabled?: boolean
  label?: string
  selected?: boolean
  value?: string
}

However lines 101-115 the options builder misses the reference and usage of this prop.
Suggest the following:

          {options
            ? options.map((option, index) => {
                return (
                  <option
                    {...(typeof option === 'object' &&
                      option.disabled && { disabled: option.disabled })}
                    {...(typeof option === 'object' &&
                      option.selected && { selected: option.selected })}
                    {...(typeof option === 'object' &&
                      option.value !== undefined && { value: option.value })}
                    key={index}
                  >
                    {typeof option === 'string' ? option : option.label}
                  </option>
                )
              })
            : children}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions