Beacon API Docs
  • Beacon - Installation
  • Beacon - Usage
    • Beacon Usage - Overview
    • Usage in a Next.js Environment
    • Open and Close Programmatically
  • Native Routing in Beacon
    • Vanilla JS - Native Routing Example
    • React JS - Native Routing Example
    • Vue JS - Native Routing Example
    • Angular JS - Native Routing Example
  • Loading User Data into BeaconBar
  • Loading Session Data into Beacon Bar
  • Callbacks in Beacon
    • Add Callbacks in Beacon
    • Remove Callbacks in Beacon
    • React Example for Callbacks
  • Trigger smart journeys From Your App
  • Execute Command From Your App
  • Open Help Docs From Your App
  • Emitting Events to Beacon
  • Listening to events from Beacon Bar
    • Adding event listeners in Beacon
    • Removing event listeners in Beacon
    • React Example for Event Listeners in Beacon
  • List of events emitted by Beacon Bar
  • Implementing Content Security Policy (CSP) for Beacon Integration
Powered by GitBook
On this page
  1. Beacon - Usage

Open and Close Programmatically

BeaconBar can be invoked by CMD+K or Ctrl+K by default for MacOS and Windows respectively. You can configure the invoke shortcuts as per your choice too, just open beacon bar in the beacon dashboard and search for 'Shortcuts'.

Sometimes you may want to invoke/close beacon bar directly without the user input/action for which you can invoke it programmatically.

If you want to programmatically control BeaconBar's visibility, you can use the following methods.

Opening BeaconBar

Calling Beacon.open() will trigger the display of the BeaconBar component, making it visible to users.

import { Beacon } from '@beacon.li/bar';

Beacon.open();

Closing BeaconBar

Conversely, if you want to programmatically close the BeaconBar, you can use this code:

import { Beacon } from '@beacon.li/bar';

Beacon.close();

Using Beacon.close() will hide or close the BeaconBar component from the user interface.

PreviousUsage in a Next.js EnvironmentNextNative Routing in Beacon

Last updated 1 year ago