A Craft CMS field type is a type of HTML field you use to create Publish Layouts for your Craft CMS project and store data associated with Elements.
A Craft CMS field type is a type of HTML field you use to create Publish Layouts for your Craft CMS project and store data associated with Elements.
A field type is not just an HTML element, like an input field, textarea, or select. Field types in Craft can be any of the HTML elements, but what makes a Craft CMS field type is the HTML element it uses plus the functionality it provides. The field type you choose will determine the UI and the kind of data that it can store.
As an example, the HTML element select
is a way to select one item from a list of many via a simple touchable or clickable interface.
The in-built version of this in Craft is the Dropdown Field. It functions just like a select
element, but Craft gives you the ability to create a new instance of the Dropdown field and set the options via a setting UI in the Craft control panel.
You can then use the Dropdown Field in a Craft publish layout to collect information for a Craft element, like an Entry, Category, or Asset.
Additionally, when you want to query for an element that has the Dropdown field you created and display it in a Twig template, Craft provides ways to access the data stored by that instance of the field.
Craft comes with 19 field types built-in for you to use in a project. All of the standard options are available, like text input, dropdown field, multi-select, and categories. There are also some Craft-specific field types like Matrix, Categories, and Assets. These fields use basic HTML field elements but combine them and add additional functionality.
If you want a field type beyond what is available in Craft CMS, you can choose one from those available in the Craft Plugin Store or create your own Craft CMS field type.