import React from 'react';
import { useHookComponent } from 'reactium-core/sdk';
export default () => {
const { Element } = useHookComponent('RTK');
return <Element title='Test'>Test Element</Element>;
};
The Element wrapper component adds the Toolbar component which has a zone included that allows you to add elements to the Toolbar.
Adding Toolbar Elements
You can add Toolbar elements by registering a component with the Toolkit SDK.
/MyPlugin/reactium-hooks.js
import Reactium from 'reactium-core/sdk';
Reactium.Plugin.register('MyPlugin').then(() => {
// Ensure the toolkit plugin is available
if (!Reactium.Toolkit) return;
Reactium.Toolkit.Toolbar.register('CustomButton', {
align: Reactium.Toolkit.Toolbar.align.left,
component: <button>CustomButton</button>,
order: Reactium.Enums.priority.neutral,
});
});
When using the Toolkit SDK to add a Toolbar component, the component you register will persist across all Toolbars. You can control it's persistence by rendering null on urls you don't want it to appear on.
You can temporarily register Toolbar elements within a useEffect: