← Back to Documentation

Field types and the content editor

Every field in <TextField> declares a type. The type decides which editing widget the panel shows you and, on the front end, which extra variables come with it.

Text is the simplest: a single-line input, printed as is. Markdown gives you a full text area backed by CodeMirror, with a small toolbar for headings, a live preview and an "insert image" button. Both the markdown source and the rendered HTML get saved: the source so you can edit it again later, the HTML so the front end never parses markdown on a request. Editor works the same way but uses Trix, for people who'd rather type in a rich-text box than write markdown.

Image and file fields handle uploads. Pick a file and the panel moves it into uploads/, checks that it really is an image when the type requires one, and can make a resized thumbnail if you've set a width or height on the field. Tags stores a comma-separated list and turns it into an array of {name: ...} entries on the front end, which makes a row of tag chips, or a flow filtered by tag, easy to build. The remaining types are color, datetime, link, email, html and boolean. Each has its own validation and widget, and each is stored as a single JSON field.

Nothing about these types is hardcoded in your templates. Add a field of any type to a static entry or a flow item from the panel, and the matching {key} variable is there the next time the page renders.