Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit 619d12c

Browse files
mgr34Matt Goo
authored andcommitted
fix(select): prop value should be string only (#725)
1 parent af449f4 commit 619d12c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

packages/select/NativeControl.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface NativeControlProps extends React.HTMLProps<HTMLSelectElement> {
3131
foundation: MDCSelectFoundation;
3232
setRippleCenter: (lineRippleCenter: number) => void;
3333
handleDisabled: (disabled: boolean) => void;
34+
value: string;
3435
}
3536

3637
export default class NativeControl extends React.Component<
@@ -49,6 +50,7 @@ export default class NativeControl extends React.Component<
4950
},
5051
setRippleCenter: () => {},
5152
handleDisabled: () => {},
53+
value: '',
5254
};
5355

5456

packages/select/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class MyApp extends React.Component {
7676
<Select
7777
label='Choose Dog'
7878
onChange={(evt) => this.setState({value: evt.target.value})}
79+
value={this.state.value}
7980
options={options}
8081
/>
8182
);
@@ -103,6 +104,7 @@ nativeControlClassName | String | An optional class added to the native `<select
103104
notchedOutlineClassName | String | An optional class added to the notched outline element. Only applied if `props.outlined` is enabled.
104105
outlined | Boolean | Enables outlined variant.
105106
options | Array{String/Object} | Array of strings or objects to be used as options. To be used instead of `<option>` elements passed as `this.props.children`. If its an array of strings, then the string value will be used as the `label` and `value` of the `<option>` tag.
107+
value | String | Optional property used to control the selected value outside of `<Select>` component.
106108

107109
### Sass Mixins
108110

packages/select/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ export interface SelectProps extends React.HTMLProps<HTMLSelectElement> {
4343
notchedOutlineClassName: string;
4444
outlined: boolean;
4545
options: SelectOptionsType;
46+
value?: string;
4647
}
4748

4849
interface SelectState {
49-
value?: string | string[] | number,
50+
value?: string;
5051
classList: Set<string>;
5152
disabled: boolean;
5253
labelIsFloated: boolean;

0 commit comments

Comments
 (0)