GoFilament
You're reading the docs for v1.35.0, an older release. Go to v1.40.1 (latest).

Docs v1.35.0 Guide

Form Builder Components

ComponentDescription
forms.TextInput(name)Text, email, password, tel, numeric with live debouncing and validation
forms.Textarea(name)Multi-line text with configurable rows and character count
forms.RichEditor(name)Full WYSIWYG rich text editor with toolbar (bold, lists, headings, links, code)
forms.MarkdownEditor(name)Markdown editor with toolbar and real-time Write / Preview tabbed interface
forms.Select(name)Dropdown options with searchability and multi-select
forms.Toggle(name)Boolean toggle switch
forms.DatePicker(name)Date and datetime-local picker
forms.FileUpload(name)Drag-and-drop file upload with live previews, multi-file and size limits
forms.ImageUpload(name)Specialized image uploader with avatar circular mode and live preview cards
forms.ColorPicker(name)Visual color picker with palette presets, native wheel, and hex sync
forms.TagsInput(name)Interactive tag pills with autocomplete suggestions and key triggers
forms.Grid(cols)Responsive multi-column layout grid
forms.Section(title)Bordered card section with collapsible support
forms.Tabs(...)Tabbed form schemas
forms.Wizard(...)Sequential step-by-step form wizard with progress indicators
forms.Repeater(name)Dynamic nested arrays with reordering (↑/↓), collapsing, and grid support

🛡️ Server-side validation and input whitelisting#

Every create, update, inline edit, relation form and row-action form is checked on the server against the form you declared, in both engines and in the API (forms.Validate). Your handler receives only the form’s fields:

  • keys that are not fields, Disabled() fields, fields hidden by Visible(...) and fields whose Dehydrated(...) returns false are dropped;
  • Required() / RequiredOnCreate(), MinLength / MaxLength, Numeric(), Email(), URL(), select / radio / checkbox options (including OptionsUsing, resolved per request), dates and times, tag limits and repeater MinItems / MaxItems are enforced, repeater items recursively;
  • updates are partial: absent keys are left alone, but a required field cannot be emptied.

A failed check answers 422 with {"error": "...", "errors": {"field": "..."}} (lines.0.sku inside repeaters); the web engine re-renders the form with the messages. Inline cell edits only reach columns that are editable in the table (ToggleColumn, SelectColumn with its options, TextInputColumn, .Editable()). Resources without a form get the data unchanged; call res.AcceptUnvalidatedInput() (or the same on a relation manager) only if your handlers validate and whitelist input themselves.

Writes also need a record the user may see: update, delete, inline edit and bulk delete load the record first, and a lookup error (404), CanView or CanEdit / CanDelete refusal (403) stops them. Bulk restore and force delete check CanRestore / CanForceDelete for every id.

Sign-in is throttled: 5 failed attempts per client and login name per minute (and 20 per client across names) answer 429 with Retry-After, on POST <panel>/api/login and the web login form. Tune it with panel.LoginThrottle(n, window) (0 disables it). Counters use golaravel’s rate limit store, in memory by default: use a Redis store when the panel runs on several processes.

📁 File & Image Uploads (forms.FileUpload & forms.ImageUpload)#

Support for drag-and-drop file handling with instant client-side image preview and circular avatar mode:

// 1. Standard Drag & Drop File Upload
forms.FileUpload("attachment").
    Label("Contract Document").
    AcceptedFileTypes("application/pdf", "image/png", "image/jpeg").
    MaxSize(10240). // 10 MB
    Required()

// 2. Mobile-First Circular Avatar Mode
forms.ImageUpload("avatar").
    Label("Profile Photo").
    Avatar().
    HelperText("Recommended: 400x400 square photo").
    Required()
  • Automatic Multipart Encoding: Forms containing upload fields automatically render with enctype="multipart/form-data".
  • Existing File Retention: Retains existing file paths (name_existing) if no replacement file is chosen.
  • Client Previews: Generates instant URL.createObjectURL thumbnail previews upon file selection without waiting for server roundtrips.

📝 Rich Text & Markdown Editors (forms.RichEditor & forms.MarkdownEditor)#

// 1. WYSIWYG Rich Text Editor
forms.RichEditor("content").
    Label("Article Body").
    MinHeight("280px").
    Required()

// 2. Dual-Mode Markdown Editor with Write / Preview Tabs
forms.MarkdownEditor("documentation").
    Label("API Documentation").
    Rows(12).
    Previewable(true)
  • RichEditor: Full formatting suite: Bold (B), Italic (I), Underline (U), Strikethrough (S), Headings (H1, H2, H3, P), Bullet Lists, Numbered Lists, Blockquotes, Code blocks, Hyperlinks with modal prompts, Clear format, and Undo/Redo.
  • MarkdownEditor: Real-time Write / Preview tab switching with instant client-side markdown parsing and token insertion toolbar.

🔁 Dynamic Reorderable Repeater (forms.Repeater)#

Allow operators to dynamically add, remove, collapse, and reorder sub-record arrays with automatic input name scoping (items[0][sku], items[1][sku]):

forms.Repeater("line_items").
    Label("Order Items").
    ItemLabel("Item").
    Collapsible(true).
    Reorderable(true). // Enables Move Up (↑) and Move Down (↓) buttons
    Grid(3).           // 3-column responsive layout per repeater item
    MinItems(1).
    MaxItems(15).
    AddActionLabel("+ Add Line Item").
    Schema(
        forms.TextInput("sku").Label("SKU").Required(),
        forms.TextInput("quantity").Numeric().Label("Qty").Required(),
        forms.TextInput("price").Numeric().Label("Price ($)").Required(),
    )
  • Automatic Bracket Notation Parsing: Server-side forms.ParseFormData automatically converts line_items[0][sku] into structured []map[string]any slices inside resource create and update handlers.
  • Reorderable & Collapsible: Move items up and down with instant DOM reordering controls; collapse completed cards to save screen space.

🏷️ TagsInput & ColorPicker#

// Interactive tag chips with autocomplete suggestions
forms.TagsInput("technologies").
    Label("Tech Stack").
    Suggestions("Go", "Ent ORM", "Laravel", "Flutter", "Tailwind", "Alpine.js").
    MaxTags(8)

// Color picker with palette swatches and 2-way hex synchronization
forms.ColorPicker("primary_color").
    Label("Brand Primary Color").
    Presets("#6366f1", "#10b981", "#f59e0b", "#ef4444", "#3b82f6", "#8b5cf6")

🧙 Multi-Step Form Wizard (forms.Wizard)#

Break complex or lengthy input workflows into structured, intuitive multi-step wizards with full step validation, progress indicators, and custom actions:

forms.Wizard(
    forms.WizardStep("Personal Information").
        Description("Your contact and profile details").
        Icon("heroicon-o-user").
        Badge("Step 1").
        BadgeColor("primary").
        Schema(
            forms.TextInput("name").Required(),
            forms.TextInput("email").Email().Required(),
        ),
    forms.WizardStep("Company Details").
        Description("Tell us about your organization").
        Icon(`<svg viewBox="0 0 20 20"><path d="..."/></svg>`).
        Badge("Optional").
        BadgeColor("warning").
        Schema(
            forms.TextInput("company_name"),
            forms.TextInput("vat_number"),
        ),
    forms.WizardStep("Confirmation").
        Description("Review terms and finalize").
        Badge("Final").
        BadgeColor("success").
        Schema(
            forms.Toggle("terms_agreed").Label("I accept terms & conditions").Required(),
        ),
).
    Skippable(false).                         // Gate forward navigation behind valid step completion
    ProgressBar(true).                        // Animated completion percentage bar
    StartStep(1).                             // Initial active step
    NextActionLabel("Continue →").           // Custom Next button label
    PreviousActionLabel("← Go Back").         // Custom Previous button label
    SubmitAction("Complete Registration").    // Custom final Submit button label
    CancelAction("/admin/users", "Cancel")    // Cancel action link
  • Client-Side Validation Gate: Evaluates checkValidity() and reportValidity() across inputs on the active step before allowing forward progression.
  • Flexible Navigation: With .Skippable(false), users can return to any previously visited step at any time while forward progression requires valid input. With .Skippable(true), users may freely jump directly to any step.
  • Dynamic Progress Bar: Live visual indicator displaying completed percentage ((currentStep / totalSteps) * 100)%.
  • Badges & Icons: Contextual badges (primary, success, warning, danger, info) and support for SVG or font icon classes.
  • Error Auto-Activation: If server validation fails upon form submission, the wizard automatically switches directly to the first step containing invalid fields.
  • Mobile Responsive: Adapts seamlessly to mobile viewports with a compact step summary (Step X of Y: Step Title) without horizontal layout overflow.

Live Reactive Fields (.Live())#

Form components update state reactively via HTMX micro-swaps:

forms.TextInput("slug").Disabled(),

forms.TextInput("title").
    Live(forms.Debounce(300 * time.Millisecond)).
    AfterStateUpdated(func(state any, form *forms.Form) {
        form.GetField("slug").SetValue(slugify(state.(string)))
    })

Generated from README.md at v1.35.0 · released Nov 17, 2026