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

In the dashboard builder, the placeholder also shows a Set up button while the widget has a metric field without a metric. The button selects the widget and opens the metric picker for its first empty metric field. The button isn't shown on dashboards outside the builder, or if all metric fields are set.

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>
}