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.
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.
Real component, fictional data. Product operations are not enabled.
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.
Second saved image.jpg
image/jpeg · Size unknown
A fictional attachment with unknown size and no source URL.
Supported inputs and ownership
| Input | Responsibility |
|---|---|
| initialData / existingFiles / categories | Permitted initial values and choices. |
| onSubmit / onCancel / isLoading | Owning lifecycle commands and busy state. |
| status / submissionFields / integrityStatement | Product policy inputs for the supported form. |
| existingFiles / onRemoveExistingFile / descriptionErrors | Supplied 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 props | files 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.