---
url: /reference/forms.md
---
# Forms

Trek ships `Trek::FormBuilder`, an extension of [`ViewComponent::Form`](https://github.com/pantographe/view_component-form)'s builder, automatically used in admin views. On top of the standard helpers, it provides:

| Helper | Renders |
| --- | --- |
| `f.group` | a wrapper giving the input nested in it a label, and a hint (errors are listed by `Trek::Form::ErrorsComponent`) |
| `f.content_editor` | the [content editor](/content-editor), based on Tiptap |
| `f.image_field` | an image uploader with thumbnail preview (Uppy + Shrine) |
| `f.sound_field` | an audio file uploader |
| `f.switch_box` | a toggle switch |
| `f.link_select` | a link picker (internal pages & external links) |

Each helper renders the matching component from the [`Trek::Form` namespace](/reference/components#form-components).

Standard helpers are styled too: a plain `f.file_field` inside an `f.group` gets its native `::file-selector-button` styled like a narrow `Trek::ButtonComponent` (following the current `data-accent-color`), keeping the browser's built-in "file chosen" feedback with no JS — handy for one-off uploads like a spreadsheet import.

```slim
= form_with model: [:admin, @book] do |f|
  = f.group :title
    = f.text_field :title
  = f.group :intro
    = f.content_editor :intro, floating: false
  = f.group :published
    = f.switch_box :published
```
