Skip to main content

Textarea

Basics

This is just a simple HTML textarea element which works within the Kingpin <Form /> component out of the box.

Props

NameMandatoryPurpose
nametrueA string which describe the element. Will be the element key in the submit payload
initialValuefalseThe textarea initial value
validationfalseA single (or an array/object of) function(s) to validate the element. Check the doc
errorClassNamefalseA className that is attached to the className on error. Check here for more.
Textarea attributesfalseAll the React textarea attributes
import { Form, FormResult, Textarea } from 'kingpin-react-form'

function App(): JSX.Element {
const submit = (e: FormEvent<HTMLFormElement>, data: FormResult) => {
e.preventDefault()
console.log(data)
}

return (
<Form onSubmit={submit}>
<Textarea name="comment" />
<button type="submit">Submit</button>
</Form>
)
}