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
Parameter | Type | Description |
---|---|---|
props | SelectedWidgetAwareProps |
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>
);