DocsFormForm Elements

Form Elements

TailAdmin provides a set of pre-designed form elements to help you create functional and user-friendly forms quickly. These elements can be customized with various props to suit your specific needs.

Input

A customizable input field for text, email, password, and other types of data entry.

Preview


Props


Prop

Type

Default

Description

type

“text” | “number” | “email” | “password” | “date” | “time” | string

”text”

Type of the input field

idstring-

ID for the input element

namestring-

Name attribute for the input

placeholder

string-

Placeholder text for the input

valuestring | number-

Current value of the input

onChange

(e: React.ChangeEvent<HTMLInputElement>) => void

-

Function to handle input changes

classNamestring""

Additional CSS classes for the input

minstring-

Minimum value for number inputs

maxstring-

Maximum value for number inputs

stepnumber-

Step value for number inputs

disabledbooleanfalse

Whether the input is disabled

successbooleanfalse

Whether to show success state

errorbooleanfalse

Whether to show error state

hintstring-

Optional hint text displayed below the input

Select

A dropdown selects input to choose from a list of options.

Preview


Props


Prop

Type

Default

Description

optionsOption[]Required

Array of option objects with value and label properties

placeholder

string”Select an option”

Placeholder text for the select input

onChange

(value: string) => void

Required

Function to handle value changes

classNamestring""

Additional CSS classes for the select input

defaultValue

string""

Default selected value

Checkbox

A toggleable checkbox input to represent a true/false value.

Preview


Props


PropTypeDefaultDescription
labelstring-Optional label for the checkbox
checkedbooleanRequiredChecked state of the checkbox
classNamestring""Additional CSS classes for the checkbox
idstring-Unique ID for the checkbox
onChange(checked: boolean) => voidRequiredChange handler for the checkbox
disabledbooleanfalseDisabled state of the checkbox

Radio

A set of radio buttons for selecting one option from a group.

Preview


Props


Prop

Type

Default

Description

idstringRequired

Unique ID for the radio button

namestringRequiredRadio group name
valuestringRequired

Value of the radio button

checkedbooleanRequired

Whether the radio button is checked

labelstringRequired

Label for the radio button

onChange

(value: string) => void

Required

Handler for value change

classNamestring""

Optional additional classes

disabledbooleanfalse

Optional disabled state for the radio button

File Upload

A file input for allowing users to upload files to your application.

Preview


Props


Prop

Type

Default

Description

classNamestringundefined

Additional CSS classes for the file input

onChange

(event: React.ChangeEvent<HTMLInputElement>) => void

undefined

Function to handle file selection changes