> For the complete documentation index, see [llms.txt](https://docs.reactium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reactium.io/reactium-toolkit/creating-elements/toolbar.md).

# Toolbar Elements

If you have created an element using the ARCLI you will notice that the generated component uses the [Element](/reactium-toolkit/components/element.md) wrapper component:

{% code title="/Reactium Project/src/app/component/Toolkit/Test/index.js" %}

```jsx
import React from 'react';
import { useHookComponent } from 'reactium-core/sdk';

export default () => {
    const { Element } = useHookComponent('RTK');

    return <Element title='Test'>Test Element</Element>;
};
```

{% endcode %}

The Element wrapper component adds the Toolbar component which has a zone included that allows you to add elements to the Toolbar.&#x20;

<div align="center"><img src="/files/-MTMeaMjKaHTCm2m68b9" alt="Toolbar Zone"></div>

## Adding Toolbar Elements

You can add Toolbar elements by registering a component with the [Toolkit SDK](/reactium-toolkit/sdk.md).&#x20;

{% code title="/MyPlugin/reactium-hooks.js" %}

```javascript
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,
    });
});
```

{% endcode %}

{% hint style="warning" %}
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.&#x20;
{% endhint %}

You can temporarily register Toolbar elements within a useEffect:&#x20;

{% code title="/Reactium Project/src/app/component/Toolkit/Test/index.js" %}

```jsx
import React, { useEffect } from 'react';
import Reactium, { useHookComponent } from 'reactium-core/sdk';


const TestToolbarButton = () => <button>Test</button>;


export default () => {
    useEffect(() => {
    
        // Ensure the Toolbar is visible
        Reactium.Toolkit.setFullscreen(false);

        // Register the TestToolbarButton
        Reactium.Toolkit.Toolbar.register('TestToolbarButton', {
            align: Reactium.Toolkit.Toolbar.align.right,
            component: TestToolbarButton,
        });

        // Unregister TestToolbarButton on unmount
        return () => {
            Reactium.Toolkit.Toolbar.unregister('TestToolbarButton');
        };
    }, []);

    return <div>Test Element</div>;
};
```

{% endcode %}

Using the [Element](/reactium-toolkit/components/element.md#properties) wrapper component, you can add temporary Toolbar elements by specifying the **toolbar** property:&#x20;

![](/files/-MTMit0xHGsX9o54K8Dz)

{% code title="/Reactium Project/src/app/component/Toolkit/Test/index.js" %}

```jsx
import React from 'react';
import { useHookComponent } from 'reactium-core/sdk';


const TestToolbarButton = () => <button>Test</button>;


export default () => {
    const { Element } = useHookComponent('RTK');

    return (
        <Element 
            title='Test'
            toolbar={TestToolbarButton}>
            Test Element
        </Element>
    );
};
```

{% endcode %}

## Registry Object

{% tabs %}
{% tab title="Properties" %}

| Property      | Type     | Description                                                      |
| ------------- | -------- | ---------------------------------------------------------------- |
| **align**     | `String` | The horizontal alignment of the component`[left\|right\|center]` |
| **component** | `Node`   | React element to insert                                          |
| **order**     | `Number` | Index used to list the Toolbar components when rendering         |
| {% endtab %}  |          |                                                                  |

{% tab title="Object" %}

```javascript
{
    align: Reactium.Toolkit.Toolbar.align.left,
    component: <button>X</button>,
    order: Reactium.Enums.priority.neutral
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.reactium.io/reactium-toolkit/creating-elements/toolbar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
