Skip to main content

Form Fields

Super Admin provides 60+ form field types.

Text Input Fields​

Text​

$form->text('title', 'Title');
$form->text('title')->rules('required|min:3');
$form->text('title')->icon('fa-pencil');
$form->text('title')->datalist(['option1', 'option2']);

Textarea​

$form->textarea('body', 'Body')->rows(10);

Email​

$form->email('email', 'Email');

Password​

$form->password('password', 'Password');

URL​

$form->url('homepage', 'Homepage');

IP Address​

$form->ip('ip_address', 'IP');

Phone Number​

$form->phonenumber('phone', 'Phone')->options(['mask' => '999 9999 9999']);

Hidden​

$form->hidden('field_name');
$form->hidden('field_name')->value('default');

Number Fields​

Number​

$form->number('quantity', 'Quantity');
$form->number('quantity')->min(0)->max(100);

Decimal​

$form->decimal('price', 'Price');

Currency​

$form->currency('price', 'Price')->symbol('$');
$form->currency('price')->symbol('EUR');

Rate​

$form->rate('rate', 'Rate');

Slider​

$form->slider('progress', 'Progress')
->attributes(['max' => 100, 'min' => 0, 'step' => 1]);

Selection Fields​

Select​

$form->select('category', 'Category')->options([
1 => 'Electronics',
2 => 'Clothing',
3 => 'Books',
]);

// From a model
$form->select('user_id', 'User')->options(User::pluck('name', 'id'));

// With AJAX loading
$form->select('user_id', 'User')->ajax('/admin/api/users');

// Cascading select (load options based on another field)
$form->select('province', 'Province')->options($provinces)
->load('city', '/admin/api/cities');
$form->select('city', 'City');

Multiple Select​

$form->multipleSelect('tags', 'Tags')->options(Tag::pluck('name', 'id'));

Listbox​

$form->listbox('permissions', 'Permissions')
->options(Permission::pluck('name', 'id'))
->height(200);

Radio​

$form->radio('status', 'Status')->options([
0 => 'Draft',
1 => 'Published',
])->default(0);

// Stacked layout
$form->radio('status')->options([...])->stacked();

Radio Button​

$form->radioButton('status', 'Status')->options([
0 => 'Draft',
1 => 'Published',
]);

Radio Card​

$form->radioCard('status', 'Status')->options([
0 => 'Draft',
1 => 'Published',
]);

Checkbox​

$form->checkbox('options', 'Options')->options([
1 => 'Option A',
2 => 'Option B',
3 => 'Option C',
]);

// Stacked layout
$form->checkbox('options')->options([...])->stacked();

Checkbox Button​

$form->checkboxButton('options', 'Options')->options([...]);

Checkbox Card​

$form->checkboxCard('options', 'Options')->options([...]);

Date & Time Fields​

Date​

$form->date('birthday', 'Birthday');
$form->date('birthday')->format('d-m-Y');

Time​

$form->time('alarm', 'Alarm Time');
$form->time('alarm')->format('HH:mm:ss');

DateTime​

$form->datetime('published_at', 'Published At');
$form->datetime('published_at')->format('YYYY-MM-DD HH:mm:ss');

Date Range​

$form->dateRange('start_date', 'end_date', 'Date Range');

Time Range​

$form->timeRange('start_time', 'end_time', 'Time Range');

DateTime Range​

$form->datetimeRange('start', 'end', 'DateTime Range');

Multiple Dates​

$form->dateMultiple('dates', 'Select Dates');

Month / Year​

$form->month('birth_month', 'Month');
$form->year('birth_year', 'Year');

File Fields​

Image​

$form->image('avatar', 'Avatar');
$form->image('avatar')->uniqueName()->removable();

Multiple Images​

$form->multipleImage('photos', 'Photos');
$form->multipleImage('photos')->removable()->sortable();

File​

$form->file('document', 'Document');
$form->file('document')->removable()->downloadable();

Multiple Files​

$form->multipleFile('attachments', 'Attachments');

See Image/File Upload for full upload configuration.

Rich Content Fields​

Editor (Rich Text)​

$form->editor('body', 'Content');

Tags​

$form->tags('keywords', 'Keywords');

Icon Picker​

$form->icon('icon', 'Icon');

Color Picker​

$form->color('theme_color', 'Color');
$form->color('theme_color')->default('#3c8dbc');

Advanced Fields​

Switch​

$form->switch('active', 'Active');

Map​

$form->map('latitude', 'longitude', 'Location')
->default(['lat' => 51.37, 'lng' => -0.09]);

Timezone​

$form->timezone('timezone', 'Timezone');

Key-Value​

$form->keyValue('settings', 'Settings');

Table (Repeater)​

$form->table('items', 'Items', function ($table) {
$table->text('name', 'Name');
$table->number('quantity', 'Qty');
$table->currency('price', 'Price');
});

List​

$form->list('features', 'Features');

Display Fields​

Display (Read-Only)​

$form->display('id', 'ID');
$form->display('created_at', 'Created');

HTML​

$form->html('<div class="alert alert-info">Custom HTML</div>');

Divider​

$form->divider();
$form->divider('Section Title');

Relationship Fields​

BelongsTo​

$form->belongsTo('user_id', UserGrid::class, 'User');

BelongsToMany​

$form->belongsToMany('roles', RoleGrid::class, 'Roles');

HasMany​

$form->hasMany('comments', 'Comments', function ($form) {
$form->text('title');
$form->textarea('body');
});

Embeds (JSON fields)​

$form->embeds('meta', 'Metadata', function ($form) {
$form->text('seo_title', 'SEO Title');
$form->textarea('seo_description', 'SEO Description');
});

Common Field Methods​

These methods work on all field types:

->value('text') // Set value
->default('value') // Set default value
->help('Help text') // Add help text below field
->placeholder('Enter value...') // Placeholder text
->required() // Mark as required
->rules('required|min:3') // Validation rules
->readonly() // Read-only
->disable() // Disabled
->autofocus() // Auto-focus on page load
->attribute(['data-id' => '1']) // HTML attributes
->setWidth(8, 2) // Field and label width