ActiveUI

ActiveUI

  • User Guide
  • Developer Documentation

Home > @activeviam/activeui-sdk > useSelectedRootDock

useSelectedRootDock() function

A React hook that provides the API of the root dock holding the widget that is currently selected to child components.

See useSelectedWidget() for more details.

Signature:

export declare function useSelectedRootDock(): SelectedRootDockProps;

Returns:

SelectedRootDockProps

Example

// Custom button for undoing the last change on a dashboard.
function UndoButton() {
  const {selectedRootDockApi} = useSelectedRootDock();
  return (
    <button
      disabled={!selectedRootDockApi.hasPreviousState()}
      onClick={() => {
        selectedRootDockApi.undo();
      }}
    >
      Undo
    </button>
  );
}

  • useSelectedRootDock() function
  • Example
Copyright © 2023 ActiveViam