Forms
Trek ships Trek::FormBuilder, an extension of ViewComponent::Form's builder, automatically used in admin views. On top of the standard helpers, it provides:
| Helper | Renders |
|---|---|
f.group | a label + input wrapper with errors |
f.content_editor | the Tiptap rich text editor |
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.
slim
= form_with model: [:admin, @book] do |f|
= f.group :title
= f.content_editor :intro, floating: false
= f.switch_box :published