All Collections
Styling and customizing your Bento experience
Sidebar toggle: Custom navigation for Bento's sidebar
Sidebar toggle: Custom navigation for Bento's sidebar

For example, include Bento in a menu, or design your own custom toggle.

Emily Wang avatar
Written by Emily Wang
Updated over a week ago

Bento comes out of the box with 5 toggle styles (Progress ring, text, etc) but some apps may want to control the navigation element that opens the sidebar.

In those cases, you can add a small line of code to your navigation element to tell Bento's sidebar to open.

Tell Bento when to open the sidebar

Once your engineers have added navigation (wherever appropriate), they can fire an event to Bento that triggers the Bento sidebar to open:

How to dispatch a custom event to Bento

const event = new CustomEvent( 'event-name', {detail: {some: 'data', to: 'include'}} ); document.dispatchEvent(event);

Toggling the sidebar open and closed

The Bento embeddable listens for two events to handle programmatically opening and closing the sidebar:

  • bento-sidebarOpen - This event is used to tell Bento to open the sidebar

  • bento-sidebarClose - This event is used to tell Bento to close the sidebar

Examples:

// open the Bento sidebar 

const event = new CustomEvent('bento-sidebarOpen'); document.dispatchEvent(event);

// close the Bento sidebar

const event = new CustomEvent('bento-sidebarClose'); document.dispatchEvent(event);

Suppress the Bento default toggle

After implementing this change, you should go into Branding settings and select "Never" under toggle visibility as your toggle style.

More info on toggle visibility and customization here.

Please note: if a user saves a guide or announcement for later, the Bento toggle will re-appear, with a small, bookmark icon. This is so your users can re-access those saved guides.

Did this answer your question?