Skip to main content

MissingConfigPlaceholder

A placeholder for widgets that can't be displayed until the user configures them, e.g. a gauge without a selected metric. It shows a widget icon and a text, styled consistently with the widgets of MoBro.

function MissingConfigPlaceholder(props: {text?: string}): JSX.Element

Props

PropTypeDescription
textstringThe text telling the user what needs to be configured.

Example

src/widgets/example/Example.tsx
import React from 'react'
import {MissingConfigPlaceholder, useIsMetricFieldConfigured, useMetricField} from '@modbros/dashboard-sdk'

export default function Example() {
const isConfigured = useIsMetricFieldConfigured({field: 'metric'})
const channelValue = useMetricField({field: 'metric'})

if (!isConfigured) {
return <MissingConfigPlaceholder text="Please select a metric"/>
}

return <span>{channelValue?.value.value}</span>
}