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:
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>
);
}