SingleSubmitField

For cases that a single textField needs to be submitted and accepted.

<SingleSubmitField
id="filled-basic"
label="Demo"
defaultValue="Text"
onSubmit={() => {}}
buttonText="Submit"
autoFocus
/>

Props

PropTypeDefaultDescription
autoCompletestringThis prop helps users to fill forms faster, especially on mobile devices. The name can be confusing, as it's more like an autofill. You can learn more about it following the specification.
autoFocusboolfalseIf true, the input element will be focused during the first mount.
buttonDisabledboolfalseIf true, the button will be disabled.
buttonTextstringText on the submit field button.
disabledboolfalseIf true, the input element will be disabled.
errorboolfalseIf true, the label will be displayed in an error state.
fullWidthboolfalseIf true, the input will take up the full width of its container.
helperTextstringThe helper text content.
idstringThe id of the input element. Use this prop to make label and helperText accessible for screen readers.
inputPropsobjectAttributes applied to the input element.
labelnodeThe label content.
multilineboolfalseIf true, a textarea element will be rendered instead of an input.
namestringName attribute of the input element.
onChangefuncCallback fired when the value is changed. Signature: function(event: object) => void event: The event source of the callback. You can pull out the new value by accessing event.target.value (string).
onSubmit() => voidEvent triggered when submit button is clicked.
placeholderstringThe short hint displayed in the input before the user enters a value.
valueanyThe value of the input element, required for a controlled component.

Examples

Error

<SingleSubmitField
id="standard-error"
label="Error"
buttonText="Submit"
error
/>

Disabled

<SingleSubmitField
id="standard-disabled"
label="Disabled"
buttonText="Submit"
disabled
helperText="Example Helper Text"
/>

With Button Disabled

<SingleSubmitField
id="standard-disabled-button"
label="Disabled Button"
buttonText="Button"
buttonDisabled
/>

Labeless

<SingleSubmitField
id="standard-default-value"
buttonText="Button"
defaultValue="Demo"
/>

Multiline

<SingleSubmitField
id="standard-multiline"
label="Multiline"
buttonText="Button"
multiline
/>

Labeless Multiline

<SingleSubmitField
id="standard-multiline"
buttonText="Button"
defaultValue="Multiline"
multiline
/>