Skip to main content

useSelectField

Field hook to access the data of a configurable field with the type select.

Arguments

The hook can take an object as argument with the following properties.

FieldTypeDescription
fieldstringThe name of the field
defaultValuestring?The default value if the field is empty

Returns

The string value of the option the user selected.

Example

src/widgets/example/Example.tsx
import React from 'react'
import {useSelectField} from '@modbros/dashboard-sdk'

export default function Example() {
const selectValue: string | null = useSelectField({field: 'example'})

return null
}