import * as React from 'react'; import * as System from '~/components/system'; import SystemPage from '~/components/system/SystemPage'; import ViewSourceLink from '~/components/system/ViewSourceLink'; const SELECT_MENU_OPTIONS = [ { value: '1', name: 'Capricorn' }, { value: '2', name: 'Aquarius' }, { value: '3', name: 'Pisces' }, { value: '4', name: 'Aries' }, { value: '5', name: 'Taurus' }, { value: '6', name: 'Gemini' }, { value: '7', name: 'Cancer' }, { value: '8', name: 'Leo' }, { value: '9', name: 'Virgo' }, { value: '10', name: 'Libra' }, { value: '11', name: 'Scorpio' }, { value: '12', name: 'Sagittarus' }, ]; const SELECT_MENU_MAP = { '1': 'Capricorn', '2': 'Aquarius', '3': 'Pisces', '4': 'Aries', '5': 'Taurus', '6': 'Gemini', '7': 'Cancer', '8': 'Leo', '9': 'Virgo', '10': 'Libra', '11': 'Scorpio', '12': 'Sagittarus', }; export default class SystemPageDropdowns extends React.Component { state = { one: '1', two: '3', three: '1', }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; render() { return ( Dropdowns

The Dropdown component is used to present the user a list of values where they can select a single option.

Usage

Define the dropdown menu options.
{`const SELECT_MENU_OPTIONS = [ { value: '1', name: 'Capricorn' }, { value: '2', name: 'Aquarius' }, { value: '3', name: 'Pisces' }, { value: '4', name: 'Aries' }, { value: '5', name: 'Taurus' }, { value: '6', name: 'Gemini' }, { value: '7', name: 'Cancer' }, { value: '8', name: 'Leo' }, { value: '9', name: 'Virgo' }, { value: '10', name: 'Libra' }, { value: '11', name: 'Scorpio' }, { value: '12', name: 'Sagittarus' }, ]; const SELECT_MENU_MAP = { '1': 'Capricorn', '2': 'Aquarius', '3': 'Pisces', '4': 'Aries', '5': 'Taurus', '6': 'Gemini', '7': 'Cancer', '8': 'Leo', '9': 'Virgo', '10': 'Libra', '11': 'Scorpio', '12': 'Sagittarus', };`}
Define the Dropdown value states and handle the state change the when a dropdown value is selected.
{`state = { one: '1', two: '3', three: '1', }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); };`}
Declare the Dropdown component.
{` {SELECT_MENU_MAP[this.state.one]} {SELECT_MENU_MAP[this.state.three]} `}

Output

{SELECT_MENU_MAP[this.state.one]}

{SELECT_MENU_MAP[this.state.three]}
); } }