Home > @activeviam/activeui-sdk > ActionsAware
ActionsAware() function
A Function As Child Component that provides an array of actions properties to its children.
Signature:
export declare function ActionsAware(props: ActionsAwareProps): JSX.Element;
Parameters
Parameter | Type | Description |
---|---|---|
props | ActionsAwareProps |
Returns:
JSX.Element
Remarks
Only the properties of those of the input actions
which are available (in the sense of the action plugin) are passed down. For a given action, these properties can be seen as the corresponding plugin methods curried with the payload
argument, where the payload
holds the widgetApi
passed as a prop but no further context.
Example
// Custom buttons to trigger ActiveUI SDK's core `undo` and `redo` actions.
const UndoRedoButtons = () => (
<ActionsAware widgetApi={widgetApi} actions={['undo', 'redo']}>
{actionsProperties => (
<Button.Group>
{actionsProperties.map(({isDisabled, caption, execute, Icon, key}) => (
<Button disabled={isDisabled} onClick={execute} key={key}>
<Icon />
{caption}
</Button>
))}
</Button.Group>
)}
</ActionsAware>
);