> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hacktionbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Widget Control

> Open, close, show, and hide the widget programmatically.

## Panel control

```javascript theme={null}
Hacktionbase.open()    // Open the widget panel
Hacktionbase.close()   // Close the widget panel
Hacktionbase.toggle()  // Toggle open/close
```

`open()` expands the chat panel from the bubble. `close()` collapses it back. These are useful for triggering the widget from your own UI elements (e.g., a "Chat with us" button).

Opening the widget also touches the session (keeps it alive) and triggers session replay if it was in buffer mode.

## Bubble visibility

```javascript theme={null}
Hacktionbase.show()   // Show the bubble and panel container
Hacktionbase.hide()   // Hide the bubble and panel container
```

`hide()` closes the panel (if open) and hides the bubble entirely. `show()` makes it visible again.

Use `hidden: true` in the init config to start with the bubble hidden, then call `show()` when you want to reveal it:

```javascript theme={null}
Hacktionbase.init({
  sdkKey: 'sk_live_abc123',
  tenant: 'acme',
  hidden: true
});

// Later, when the user reaches a specific page:
Hacktionbase.show();
```

## Use cases

| Scenario                             | Method                                              |
| ------------------------------------ | --------------------------------------------------- |
| Custom "Help" button in your nav     | `Hacktionbase.open()` on click                      |
| Hide widget on checkout pages        | `Hacktionbase.hide()` on route change               |
| Show widget only for logged-in users | Init with `hidden: true`, call `show()` after login |
| Toggle from a keyboard shortcut      | `Hacktionbase.toggle()` in your key handler         |
