M
M
Magny resources
Search…
⌃K

Adding Magny to your app

This page explains how to add the Magny search bar to your application.

Adding Magny to your app

To add Magny to your application, run npm i magny. This will add Magny’s code to your app, but Magny still needs to be initialized to be usable.
To initialize Magny, add the following code to your app. To ensure that it starts as fast as possible, add this code closer to your app’s entry point, e.g. to index.js, index.ts, App.js orApp.ts.
import Magny from 'magny-react'
import "magny-react/style.css";
function App() {
return (
<div>
<Magny projectId="8684570a-fde9-4e06-9ce5-a09e1e018cc7" />
</div>
);
}
export default App;
Make sure you change the ProjectID to the ID of the project. This can be found under Projects -> Settings -> Installation.
Make sure you have switched your project's status from Draft to Active. Otherwise, the Magny search bar won't be visible to users.
Now, the Magny command palette is ready to be run with Cmd-K keyboard shortcut.