A better gender form option implemeted as a react component
View the component in action in our interactive demo
Use yarn or npm to install react-gender-input
yarn add react-gender-input
or npm install --save react-gender-input
import { GenderInput } from 'react-gender-input';
<GenderInput
name='my-gender-field-name'
onUpdate={(val) => {...}}
value={user.gender}
/>
name
: type: string
, default: gender-input
. Form name property used for the inputvalue
: type: string
. Selected gender valuerequired
: type boolean
, default: false
. Toggles `required="required" on form inputsVYpreferNotToSay
: type boolean
, default: true
. Toggles an additional "Prefer not to say option"otherReveal
: type 'select' | false
, default: select
. Defines form input that is revealed on selecting "Other"onUpdate
: type function
. Method to call when the selected value changes. Called with one argument: the new value.