Dashboard widget

Dashboard widget specific context keeps the widget container title on this dashboard as well as its consolidated state after view mode modifications

Context value

type DashboarWidgetContext = {
    title: string
    setTitle: string => void
    widget: LiveWidgetEntity // the consolidated widget configuration
    state: LiveDashboardWidgetState // LiveDashboardWidgetState
}

Usage

import React, { useContext } from 'react'
import { DashboardWidgetContext } from 'live/context/dashboard-widget'

export default () => {
    const context = useContext(DashboardWidgetContext)

    function updateTitle() {
        context.setTitle(<span style={{color: 'red'}}>My title</span>)
    }
    return <a onClick={updateTitle}>change title</a>
}

Other Widget Types

Last updated

Was this helpful?