Skip to main content

Installation

Requirements:

  • React 18.2 or later - react
  • React DOM 18.2 or later - react-dom

Installing the package​

Start using AndrejGround Lab now by installing it as an NPM package.

Install​

Run one of the following commands in your terminal:

npm install @andrejground/lab

Import the styles​

Add the following line to the root of your app:

App.tsx
import '@andrejground/lab/style.css';

Use the components​

Add your styles and your component is ready to be used.

import MyPopover from './MyPopover';
// ...
return (
<MyPopover>
<MyPopover.Trigger>Popover Trigger</MyPopover.Trigger>
<MyPopover.Content>Popover Content</MyPopover.Content>
</MyPopover>
);

Frameworks​

AndrejGround Lab is compatible with your preferred framework.

Next.js​

All the components and hooks already include the "use client" directive, which means you can import and use them directly in your RSC.

Astro​

In Astro, you can use the client:load or client:only directives for your React components - meaning they'll only run in the browser.

MyComponent.astro
<MyPopover client:load>
<MyPopover.Trigger>Popover Trigger</MyPopover.Trigger>
<MyPopover.Content>Popover Content</MyPopover.Content>
</MyPopover>