Skip to documentation

Design system / Organisms

Organism / Intake and review

SubmissionForm

SubmissionForm combines fields, attachments, readiness feedback and draft or submitted-status actions around one batch-save contract.

SubmissionsOrganism

Intent and composition

useSubmissionForm owns field and attachment drafts, dirty tracking and the saved baseline. The caller supplies initial values and onSubmit/onCancel commands. Pending uploads block saving; an explicit false result retains the dirty draft. Creation and editing instances supply distinct persistence lifecycles. Existing attachments render through the submissions-owned SubmissionFileDisplay molecule. Its implementation is referenced in Molecules & instances. It displays supplied metadata and optional controlled description/removal commands without fetching metadata or owning persistence. A referenced file's unknown size displays as Size unknown, never zero. Attachment does not guarantee source availability.

Coordinated concerns: Entry fields, existing/new attachments, readiness, dirty feedback and draft/submitted actions.

useSubmissionForm owns draft behavior; the caller supplies permitted categories, initial values and submit/cancel commands. Create/edit instances bind the product lifecycle without authorizing it.

Real component specimen

Actual form using its supported busy state, including a fictional existing attachment with unknown size and a description error. Fields, attachments and save actions are disabled. A separate local-only SubmissionFileDisplay example demonstrates pointer and keyboard reordering of saved-file metadata. It does not save or upload anything. No source URL is supplied.

Live preview

Real component, fictional data. Product operations are not enabled.

Submission Status

Currently a draft.

Before submitting:

  • Add Category.

You can save a draft with only a Campaign Title.

No unsaved changes.

Reorder these fictional saved files by dragging a handle, or use Space, Arrow Up or Arrow Down, then Space. Escape cancels. This example changes local order only; it does not save or upload files.

First saved image.jpg

image/jpeg · Size unknown

A fictional attachment with unknown size and no source URL.

Supporting Media

Second saved image.jpg

image/jpeg · Size unknown

A fictional attachment with unknown size and no source URL.

Supporting Media

Supported inputs and ownership

SubmissionForm input summary
InputResponsibility
initialData / existingFiles / categoriesPermitted initial values and choices.
onSubmit / onCancel / isLoadingOwning lifecycle commands and busy state.
status / submissionFields / integrityStatementProduct policy inputs for the supported form.
existingFiles / onRemoveExistingFile / descriptionErrorsSupplied existing attachment metadata, optional creation-lifecycle removal callback and asset-keyed description errors. Without status, existingFiles remains parent-controlled: update it after onRemoveExistingFile. Current metadata, readiness and the save payload follow those updates. In edit mode (status supplied), useSubmissionForm owns kept-file order and description drafts; parent rerenders do not reset unsaved edits. The form maps errors by file ID for SubmissionFileDisplay. Description, removal and order changes save with the submission, not on each edit. Failed saves preserve the draft; successful saves reset its dirty baseline. Newly uploaded files follow retained files.
SubmissionFileDisplay propsfiles is required; an empty collection renders nothing. Optional onRemove shows removal controls. descriptionValues and descriptionErrors are file-ID maps; onDescriptionChange enables image/video textareas (maximum 1000 characters). Optional onReorder(activeId, overId) enables controlled dnd-kit handles using stable file IDs. Drag with a pointer, or use Space, Arrow Up/Down and Space; Escape cancels. disabled blocks reorder, description and removal controls, including a drop during saving. Without edit callbacks, the display remains read-only. The molecule stacks preview, information and actions in narrow containers; wider containers retain the horizontal row. Its owner controls this geometry without clipping fields or changing text sizes. Image previews use supplied URLs; this molecule does not resolve access or provide gallery-style error recovery.

This is an integration summary, not a replacement for the implementation's complete prop types. A disabled control or hidden destination does not enforce permission.

Using it in a page

Integrate the section through its supported props and context requirements. Routes supply permitted data; instances bind product copy and behavior; templates arrange slots. Keep feature hooks and operations with their feature owner. Generic layouts must not load business data or enforce product policy.

Related page assemblies: Create or edit a submission.

Implementation

src/components/submissions/submissionForm.tsx
All organisms
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.