Easily restore your project to a previous version with our new Instant One-click Backup Recovery
Hygraph
Docs

useFieldExtension

useFieldExtension()
Hook function for field elements.

Properties

  • name
    type string
    Name of the field in the form.
  • locale
    type string
    Current locale on localized field.
  • entryId
    type string | null
    Id of the current entry, null on a new entry.
  • isTableCell
    type boolean
    Whether or not the field displays in a table view.
  • value
    type any
    Value field.
  • onBlur
    type method
    Is triggered when an HTML element loses focus.
  • onChange
    type method
    Is triggered when you change the value.
  • onFocus
    type method
    Is triggered when an element gets focus.
  • meta
    • active
      type boolean
      Whether or not the field currently has focus.
    • error
      type any
      The current validation error for the field.
    • touched
      type boolean
      Whether or not this field has ever gained and lost focus.
      It can be useful to indicate when to display error messages.
  • form
    type Object | Form
    Contains methods to interact with the content form
  • field
    • id
      type string
      Id of the current field.
    • apiId
      type string
      apiId of the current field.
    • description
      type string | null
      Description of the current field.
    • displayName
      type string | null
      Display name of the current field.
    • isList
      type boolean
      Whether or not not the current field is a list.
    • isLocalized
      type boolean
      Whether or not the current field is localized.
    • isRequired
      type boolean
      Whether or not the current field is required.
    • isUnique
      type boolean
      Whether or not the current field is unique.
    • isUnique
      type boolean
      Whether or not the current field is unique.
    • isPreview
      type boolean
      Whether or not the current field is a preview. True when in version or stage comparison view
    • type
      type FieldExtensionType
      Key of FieldExtensionType.
  • model
    type Model
    Details about the current model.
  • extension
    • config
      type object
      Global configuration of the field.
    • fieldConfig
      type object
      Configurations that display at the field level.
    • tableConfig
      type object
      Configurations that display at the table level.
  • isExpanded
    type boolean
    Whether or not the field is currently in fullscreen mode.
  • expand
    type boolean
    Sets fullscreen mode.

Returns

<FieldExtensionProps | interface>