Skip to content

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:

HelperRenders
f.groupa label + input wrapper with errors
f.content_editorthe Tiptap rich text editor
f.image_fieldan image uploader with thumbnail preview (Uppy + Shrine)
f.sound_fieldan audio file uploader
f.switch_boxa toggle switch
f.link_selecta 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

Released under the MIT License.