ActiveUI

ActiveUI

  • User Guide
  • Developer Documentation

Home > @activeviam/activeui-sdk > SelectedWidgetAware

SelectedWidgetAware() function

A Function As Child Component that provides the API of the currently selected widget to child components, or undefined if no widget is selected.

Signature:

export declare function SelectedWidgetAware(props: SelectedWidgetAwareProps): JSX.Element;

Parameters

ParameterTypeDescription
propsSelectedWidgetAwareProps

Returns:

JSX.Element

Remarks

A widget is considered as selected when:

  • It has just been loaded

  • It has been actively selected by the user by clicking on it or its background

Example

// Custom button to show/hide the selected widget's title bar.
const ShowHideTitleToggle = () => (
 <SelectedWidgetAware>
   {selectedWidgetApi => (
       <Button
         onClick={() => {
           selectedWidgetApi.setBookmarkShowTitleBar(
             !selectedWidgetApi.getBookmarkShowTitleBar(),
           );
         }}
       >
         Show/hide title bar
       </Button>
     )}
 </SelectedWidgetAware>
);

  • SelectedWidgetAware() function
  • Parameters
  • Remarks
  • Example
Copyright © 2023 ActiveViam