Components Forms
File upload
Forms file_upload
A file input field.
Markup
Drops in as data-pb-block="file_upload".
html
<label data-pb-block="file_upload" class="pb-field" style="display:block;font-family:inherit;max-width:24rem;">
<span class="pb-field__label" style="display:block;font-size:0.875rem;font-weight:600;color:var(--pb-ink,#0f172a);margin-bottom:0.35rem;">Upload a file</span>
<input type="file" name="file" style="width:100%;padding:0.5rem;border:1px dashed #cbd5e1;border-radius:0.5rem;font:inherit;color:var(--pb-muted,#64748b);box-sizing:border-box;">
</label>Settings
Everything a block can be configured to do:
- Bind to State
- Drive content reactively from a State with declarative Alpine —
x-text,x-showorx-modelover$store.app.<stateKey>. - On event → run a Flow
- Wire an interaction to a Flow: set
data-pb-flow="<slug>"anddata-pb-flow-event="click|submit|hover|change|…". The flow's returned actions update the page. - Link to a page
- Navigate to another published page on click with
data-pb-page="<slug>". - Styles & classes
- Edit spacing, colour and layout visually in the GrapesJS editor. The wrapper carries
data-pb-block="file_upload"so it imports as a labelled, editable component. - Field name
- The control's
namemaps to a collection field key — the runtime collects it on submit of the surrounding Form. - Validation
- Mark it
required; the collection field's type and options (e.g.email,selectchoices) drive server-side validation.