Skip to main content

FormControl

@This is a neutral caption
import { FormControl, TextInput } from '@tulsa/core';

<FormControl>
<FormControl.Label>Twitter Username</FormControl.Label>
<TextInput leadingVisual={"@"} />
<FormControl.Caption>This is a neutral caption</FormControl.Caption>
</FormControl>

Props

NameTypeDescriptionDefault
status'neutral' | 'success' | 'error'Controls the look and feel of the formneutral
idstringManually sets the id and accessibility of the `for` attribute of the form
asTControls the root element that is used by the FormControl. Can be an HTML element string or a React componentdiv

Native props are forwarded to the root component.

Examples

Success and Error

@This is an errored caption
@This is successful caption
This is successful caption
<FormControl status='error'>
<FormControl.Label>Twitter Username</FormControl.Label>
<TextInput leadingVisual={"@"} />
<FormControl.Caption>This is an errored caption</FormControl.Caption>
</FormControl>

<FormControl status='success'>
<FormControl.Label>Twitter Username</FormControl.Label>
<TextInput leadingVisual={"@"} />
<FormControl.Caption>This is successful caption</FormControl.Caption>
</FormControl>

<FormControl status='success'>
<FormControl.Label>Enter a Description</FormControl.Label>
<TextArea />
<FormControl.Caption>This is successful caption</FormControl.Caption>
</FormControl>

FormControl.Label

Props

NameTypeDescriptionDefault
childrenstring | React.ReactElementContent of the associated form's label

Native props are forwarded to the root component.

FormControl.Caption

Props

NameTypeDescriptionDefault
childrenstring | React.ReactElementContent of the associated form's caption

Native props are forwarded to the root component.