<input>
The built-in browser <input> component lets you render different kinds of form inputs.
<input />Reference
<input>
To display an input, render the built-in browser <input> component.
<input name="myInput" />Props
<input> supports all common element props.
You can make an input controlled by passing one of these props:
checked: A boolean. For a checkbox input or a radio button, controls whether it is selected.value: A string. For a text input, controls its text. (For a radio button, specifies its form data.)
When you pass either of them, you must also pass an onChange handler that updates the passed value.
These <input> props are only relevant for uncontrolled inputs:
defaultChecked: A boolean. Specifies the initial value fortype="checkbox"andtype="radio"inputs.defaultValue: A string. Specifies the initial value for a text input.
These <input> props are relevant both for uncontrolled and controlled inputs:
accept: A string. Specifies which filetypes are accepted by atype="file"input.alt: A string. Specifies the alternative image text for atype="image"input.capture: A string. Specifies the media (microphone, video, or camera) captured by atype="file"input.autoComplete: A string. Specifies one of the possible autocomplete behaviors.autoFocus: A boolean. Iftrue, React will focus the element on mount.dirname: A string. Specifies the form field name for the element’s directionality.disabled: A boolean. Iftrue, the input will not be interactive and will appear dimmed.children:<input>does not accept children.form: A string. Specifies theidof the<form>this input belongs to. If omitted, it’s the closest parent form.formAction: A string. Overrides the parent<form action>fortype="submit"andtype="image".formEnctype: A string. Overrides the parent<form enctype>fortype="submit"andtype="image".formMethod: A string. Overrides the parent<form method>fortype="submit"andtype="image".formNoValidate: A string. Overrides the parent