0.1.1 • Published 6 years ago
@alexseitsinger/react-simple-text-input v0.1.1
SimpleTextInput
An input that has a built in error message.
Parameters
propsobjectprops.isSubmittedboolean The boolean value if the form is submitted.props.setSubmittedfunction The function to invoke to toggle that the form is submitted.props.isEmptyboolean If this input element is currently emptyprops.setEmptyfunction The function to invoke to toggle the inputs emptyness stateprops.valueboolean The current value of the inputprops.setValuefunction The function to invoke to set the inputs valueprops.errorMessagestring The message to display when the input is empty.props.errorPositionstring The placement of the error in the input element.props.errorStyleobject The inline style tp use on the error element.props.placeholderstring The placeholder text to use.props.inputStyleobject The inline style to use on the input element.
Examples
import React from "react"
import { SimpleTextInput } from "@alexseitsinger/react-simple-text-input"
function App({ ... }) {
return (
<Form onSubmit={onSubmit}>
<SimpleTextInput
value={inputValue}
setValue={setInputValue}
isEmpty={isInputEmpty}
setEmpty={setInputEmpty}
isSubmitted={isSubmitted}
setSubmitted={setSubmitted}
placeholder={"Input..."}
errorMessage={"The input is empty."}
errorPosition={"centerLeft"}
errorStyle={{width: "100%", height: "100%"}}
inputStyle={{backgroundColor: "#FFFFFF", padding: "0.333em"}}
/>
</Form>
)
}Returns function A controller stateless functional component.
0.1.1
6 years ago