Skip to Content
🎉 Coral x Panda has been released 🎉 Read the Migration Guide
DocumentationFormikFormikTextArea

FormikTextArea

Basic Usage

import { FormikTextArea } from '@krakentech/coral-formik'; import { Button } from '@krakentech/coral'; import { Formik, Form } from 'formik'; <Formik initialValues={{ textarea: '' }} onSubmit={() => console.log('Submitted')} validationSchema={yup.object().shape({ textarea: yup.string().required('This field is required'), })} > <Form method="post"> <FormikTextArea name="textarea" label="Textarea" /> <Button type="submit">Submit</Button> </Form> </Formik>

Full API

NameTypeDefault
disabledboolean

If true, the component will be disabled and not respond to user interactions.

false
idstring

The id of the input element. If unspecified, an id will be generated internally.

labelstring

The accessible label for the text area.

namestring

The field name used on the POST request when the form is submitted.

onBlurFocusEventHandler<HTMLTextAreaElement>

Callback fired when the text area loses user focus.

onChangeChangeEventHandler<HTMLTextAreaElement>

Callback fired each time the user types in the text area.

onFocusFocusEventHandler<HTMLTextAreaElement>

Callback fired when the text area receives user focus.

placeholderstring

Optionally displays a text hint in the field, before it is populated.

optionalboolean

Add an optional flag to the label for this field (controlled by https://coral-oe.vercel.app/?path=/docs/guides-configuration—docs#overrides-optional-indicator  optionalIndicator). This should be set to true if you have set this field to be optional in your validation schema.

false
rowsnumber

Specifies the visible number of lines in a text area.

3
themeResponsiveVariant<"base100" | "secondary500">

The colourway applied to this component.

base100
attributesAttributes

This prop can be used to pass HTML attributes directly to the component. We currently allow passing data-* and aria-* attributes and the id. However, you can pass anything else with a type hack if necessary since this object is despread in to the component, without filtering its content.

Example usage:

AttributesProps: { 'id': 'close-button', 'aria-label': 'Close button', 'data-testid': 'close-button' };
validateFieldValidator | undefined

An optional field level validation function. See Formik docs  for more details

refRef<HTMLTextAreaElement> | undefined

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

keyKey | null | undefined
Last updated on