Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FormContainerProps

Hierarchy

Index

Properties

Optional addFields

addFields: string[]

List default fields + those additional fields as well

Optional currentUser

currentUser: null | VulcanUser

Force a currentUser, overriding the currentUser obtained via Context

If you use many forms in your app, it might be better to set VulcanCurrentUserContext at the top-level of your app (eg in "pages/_app.js" for Next.js)

Optional disabled

disabled: boolean

Disable the form

Optional documentId

documentId: string

Document id for edition mode, will automatically fetch the document

Optional fields

fields: string[]

List only those fields in the form

Optional itemProperties

itemProperties: Object

Optional loadingCurrentUser

loadingCurrentUser: boolean

model

model: VulcanGraphqlModel

Optional mutationFragment

mutationFragment: string | DocumentNode

A GraphQL fragment used to specify the data to return once a mutation is complete.

If no fragment is passed, SmartForm will only return fields used in the form, but note that this might sometimes lead to discrepancies when compared with documents already loaded on the client.

An example would be a createdAt date added automatically on creation even though it’s not part of the actual form. If you’d like that field to be returned after the mutation, you can define a custom mutationFragment that includes it explicitly.

Can be either a string or a DocumentNode (using "gql" tag)

Optional mutationFragmentName

mutationFragmentName: string

Force a mutation fragment name

NOTE: needed only for string fragments If you use a DocumentNode (with "gql" tag), it will be computed automatically

deprecated

Prefer using DocumentNode fragment, using the gql tag

Optional queryFragment

queryFragment: string | DocumentNode

A GraphQL fragment used to specify the data to fetch to populate edit forms. If no fragment is passed, SmartForm will do its best to figure out what data to load based on the fields included in the form.

Can be either a string or a DocumentNode (using "gql" tag)

Optional queryFragmentName

queryFragmentName: string

Force a query fragment name

NOTE: needed only for string fragments If you use a DocumentNode (with "gql" tag), it will be computed automatically

deprecated

Prefer using DocumentNode fragment, using the gql tag

Optional showDelete

showDelete: boolean

Optional slug

slug: string

Slug (= human readable unique id) for edition mode, will automatically fetch the document

Optional warnUnsavedChanges

warnUnsavedChanges: boolean

Will prevent leaving the page/unmounting the form on unsaved changes

Methods

Optional errorCallback

  • errorCallback(document: any, error: any, meta: { form: any }): void
  • Parameters

    • document: any
    • error: any
    • meta: { form: any }
      • form: any

    Returns void

Optional submitCallback

  • submitCallback(data: any): any

Optional successCallback

  • successCallback(document: any, meta: { form: any }): void
  • Parameters

    • document: any
    • meta: { form: any }
      • form: any

    Returns void

Generated using TypeDoc