Skip to content

Commit

Permalink
feat(Select): Add optional key to Option (#1708)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirJarabica committed Mar 24, 2020
1 parent 33a9474 commit f824d4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Select/index.js
Expand Up @@ -330,7 +330,11 @@ const Select = React.forwardRef<Props, HTMLElement>((props, ref) => {
</option>
)}
{options.map(option => (
<option key={`option-${option.value}`} value={option.value} disabled={option.disabled}>
<option
key={`option-${option.key || option.value}`}
value={option.value}
disabled={option.disabled}
>
{option.label}
</option>
))}
Expand Down
1 change: 1 addition & 0 deletions src/Select/index.js.flow
Expand Up @@ -14,6 +14,7 @@ import type {
import type { spaceAfter } from "../common/getSpacingToken/index";

type Option = {|
+key?: string,
+value: string | number,
+label?: string,
+disabled?: boolean,
Expand Down
1 change: 1 addition & 0 deletions src/SkipNavigation/index.js.flow
Expand Up @@ -10,6 +10,7 @@ type Actions = {|
|};

export type MappedOptions = {|
+key?: string,
+value: string | number,
+label?: string,
+disabled?: boolean,
Expand Down

0 comments on commit f824d4a

Please sign in to comment.