Skip to main content

Initializing a project

If you have not set up a project yet, you can easily initialize a ShadCN / Next.js project with the following command:
Or if you prefer not to use ShadCN:

Overview

The logic of the websocket chat is handled by a React provider. You can install it with this command:
We support multiple project setups out of the box.

Using ShadCN

After you have installed the provider, copy this component into your ShadCN project:
chat.tsx
You can then use the component inside the MagmaChatProvider from the react-obsidian package you installed earlier:
page.tsx

Using TailwindCSS

This example assumes you have background and foreground tailwind color variables defined
After you have installed the provider, copy this component into your TailwindCSS project:
chat.tsx
You can then use the component inside the MagmaChatProvider from the react-obsidian package you installed earlier:
page.tsx

Using CSS Modules

This example assumes you have background and foreground css color variables defined
After you have installed the provider, copy this component into your CSS Modules project:
chat.tsx
Also copy the corresponding styles:
chat.module.css
You can then use the component inside the MagmaChatProvider from the react-obsidian package you installed earlier:
page.tsx