# Types of fields

Lyra includes the most commonly used data types.

# Text field

The text field is the simplest of the editable fields, it will display a text entry.


# URL field

It shows a clickable link in the index and show views.


# Slug field

Displays a text field with a slug pattern filter


In addition to the functionality of the Text field, it has the sluglify method to auto-generate the slug from another existing field.

This method requires the name of the column in the source field.


The slug will be created automatically as you type in the source field, as long as there is no previous value in the 'Slug' field when you access the form.

# Textarea field

Muestra un elemento textarea con posibilidad de expandirlo verticalmente.


# Password field

Displays a password type input field, always displays a placeholder even if it has a value and saves a hash of the password.


# Date field

Displays a date type entry field


# DateTime field

Displays a datetime field with date and time.

DateTime::make('Published At')

# File field

This field allows the upload of any type of file.


# Field Image

It allows the upload of images offering a preview of the same.


# Field Markdown

Shows the EasyMDE editor for Markdown.


# Boolean field

This field is used to represent a boolean value, it shows a ✔️ when the value is true, and an ❌ if the value is false.


You can set the true and false values if, for example, you have an enum field in your database, to do this you must use the values method.

This method requires two parameters, the first will be the true value and the second will be the false value.

Boolean:make('Status')->values('ACTIVE', 'FALSE')

In addition, you can set whether you want it to be marked as default or not. If you want it to be checked you must use the checked method.


# Select field

This field shows a selectable drop-down list with multiple options, which options must be added to the field using the options method.

  'Draft', 'Pending', 'Published'

You can also use an associative array, the key will be saved in the database and the value will be displayed in the drop-down list.

  'draft' => 'Draft',
  'pending' => 'Publish pending', 'published' => 'Published'

To define a default value you must use the default method.

  'Draft', 'Pending', 'Published'
Select::make('Status')->options([ 'draft' => 'Draft',
  'pending' => 'Publish pending', 'published' => 'Published'

# Radio field

This field shows a group of radio buttons, you must specify the available options using the options method.

Radio::make('Status')->options(['Draft', 'Pending', 'Published'])

You can also use an associative array, the key will be saved in the database and the value will be displayed next to each radio button.

  'draft' => 'Draft',
  'pending' => 'Publish pending',
  'published' => 'Published'

To define a default value you must use the default method.

  'Draft', 'Pending', 'Published'
  'draft' => 'Draft',
  'pending' => 'Publish pending',
  'published' => 'Published'

# Heading field

This field does not correspond to any column in the database. It shows a separator to group different fields in the show and edit views.


You can also display HTML code which will be rendered by the user's browser.

Heading::make('Extra data - <span style="color:red">Important</span>')

# Code field

The field will display the CodeMirror editor.

This field supports multiple modes, to specify a mode you must use the mode method.

The available modes are:


If you want to use JSON in this field, you must use the json method.