sisense.com
✅ You are viewing documentation for the latest version of Compose SDK.
Version:

Function useComposedDashboard

useComposedDashboard<D>(initialDashboard, options? = {}): ComposedDashboardResult< D >

React hook that takes in separate dashboard elements and composes them into a coordinated dashboard with change detection, cross filtering, and drill down.

Type parameters

ParameterDescription
D extends ComposableDashboardProps | DashboardPropsThe type parameter for a dashboard properties, restricted to ComposableDashboardProps or DashboardProps.

Parameters

ParameterTypeDescription
initialDashboardDSet of properties for the Dashboard component.
options?UseComposedDashboardOptionsOptions for the composable.

Returns

ComposedDashboardResult< D >

An object containing the composed dashboard and APIs to interact with it.

Example

import { type DashboardProps, FilterTile, useComposedDashboard, Widget } from '@sisense/sdk-ui';

const CodeExample = () => {
  const dashboardProps: DashboardProps = { ... };

  const {
    dashboard: { title, widgets, filters = [] }
  } = useComposedDashboard(dashboardProps);

  return (
    <div>
      <span>{title}</span>
      <div>
        {widgets.map((widget) => (
          <Widget key={widget.id} {...widget} />
        ))}
      </div>

      {Array.isArray(filters) ? filters.map((filter) => (
        <FilterTile
          key={filter.name}
          filter={filter}
          onChange={(filter) => console.log('Updated filter', filter)}
        />
      )) : null}
    </div>
  );
}
  export default CodeExample;
Last Updated: