Skip to main content

useFontField

Field hook to access the data of a configurable field with the type font. The font is served automatically from the system MoBro is running on, so it does not have to be installed on the system which displays the dashboard.

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 which represent the font name that the user selected.

Example

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

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

return null
}