Fieldtypes

Fieldtypes give you the ability to structure your content through the use of tailored interfaces designed for different types of data. They are the Control Panel connection to the Flat Files that make Statamic what it is. Every fieldtype is ultimately writing YAML in a pre-determined format for you.


Default Settings

Most fieldtypes share a common set of default settings, like validation, display text, instructions, and so on. You’ll see this list referenced throughout the docs.

  • Not available on fields inside a bard, replicator or grid field.
display

string

The label shown above the field

instructions

string

Help text shown underneath the display label. Markdown supported.

localizable

boolean

Enable localization (the ability to translate this field)

width

int

The fields's width layout, in percentages (e.g. 100, 50)

validate

string

A pipe delimited string of validation rules*

bold

boolean false

Setting to true will make the field label bold.

show_when

string|array

The conditions under which this field should be displayed. You can do things like "show this field when this other field has this value"*. Learn how to configure conditional fields

hide_when

string|array

The same as show_when, but with the logic inverted*.

replicator_preview

boolean true

When set to false, this field will not be displayed in the preview text for a collapsed Replicator set.

placeholder

string

The placeholder text to be shown in the field for fieldtypes that support it. (eg. text and textarea)

classes

string

CSS class names that you want applied to the field wrapper.