required attribute not functioning for Dropdown

Author: dsullivan7Created Jan 18, 2018Updated Sep 25, 2025
LabelsType: Buggood first issue

I'm using 2.0.0-beta.12 and I've noticed that the required attribute does not function as expected:

class DropdownTest extends React.Component {
  state = { value: null }

  handleChange = (value) => {
    this.setState({value: value})
  }

  render() {
    return (
      <Dropdown
        required
        onChange={this.handleChange}
        source={[{value: 1, label: 'option 1' }, {value: 2, label: 'option 2' }]}
        value={this.state.value}
      />
    )
  }
}

const Form = () => (
  <form>
    <DropdownTest />
    <Button type="submit" raised primary>Submit</Button>
  </form>
)

In this example, the submit button still executes the default submit function. I was able to use the Input component with the required attribute and get the desired functionality.

Source: react-toolbox/react-toolbox