Components

Drawer

An organized slide-out panel for displaying overlay content

Logo

Type

The Drawer is available in two types, use the type prop to change

Position

Use the position prop to change the drawer position

Using DrawerTrigger

You can use the DrawerTrigger on componenet which do not support the trigger

Reference

Below you'll find source code for the above overlays and it content

Demo Drawer

components/overlays/drawer-demo.tsx

import {
Drawer,
DrawerPanel,
DrawerHeader,
DrawerContent,
IconButton,
closeDrawer
} from "auera-ui";
import { IoClose } from "react-icons/io5";
import Drawer_Content from "../example/DrawerContent";
const DemoDrawer = () => {
return (
<Drawer value="drawer-demo">
<DrawerPanel>
<DrawerHeader>
<h1 className="font-medium text-lg theme-dark:text-white">
Notifications
</h1>
<IconButton onClick={closeDrawer} variant="outline">
<IoClose />
</IconButton>
</DrawerHeader>
<DrawerContent>
<Drawer_Content />
</DrawerContent>
</DrawerPanel>
</Drawer>
);
};
export default DemoDrawer;

Float Drawer

components/overlays/float-drawer.tsx

import {
Drawer,
DrawerPanel,
DrawerHeader,
DrawerContent,
IconButton,
closeDrawer
} from "auera-ui";
import { IoClose } from "react-icons/io5";
import Drawer_Content from "../example/DrawerContent";
const FloatDemoDrawer = () => {
return (
<Drawer value="drawer-demo-float">
<DrawerPanel type="float">
<DrawerHeader>
<h1 className="font-medium text-lg theme-dark:text-white">
Notifications
</h1>
<IconButton onClick={closeDrawer} variant="outline">
<IoClose />
</IconButton>
</DrawerHeader>
<DrawerContent>
<Drawer_Content />
</DrawerContent>
</DrawerPanel>
</Drawer>
);
};
export default FloatDemoDrawer;

Left Drawer

components/overlays/left-drawer.tsx

import {
Drawer,
DrawerPanel,
DrawerHeader,
DrawerContent,
IconButton,
closeDrawer
} from "auera-ui";
import { IoClose } from "react-icons/io5";
import Drawer_Content from "../example/DrawerContent";
const LeftDrawer = () => {
return (
<Drawer value="left-drawer-demo">
<DrawerPanel position="left">
<DrawerHeader>
<h1 className="font-medium text-lg theme-dark:text-white">
Notifications
</h1>
<IconButton onClick={closeDrawer} variant="outline">
<IoClose />
</IconButton>
</DrawerHeader>
<DrawerContent>
<Drawer_Content />
</DrawerContent>
</DrawerPanel>
</Drawer>
);
};
export default LeftDrawer;

Drawer_Content

A list of notifications grouped by timestamp using GroupMap

components/examples/DrawerContent.tsx

import React from "react";
import { GroupMap, Box, colors, StatusBadge } from "auera-ui";
import { notifications } from "@/data/notification";
import { formatTime } from "@/utils/formatTime";
const Drawer_Content = () => {
return (
<GroupMap
data={notifications}
className="gap-3"
dataMapClass="gap-3"
renderItem={(item, index) => (
<Box
key={index}
direction="column"
className="
gap-2 p-4 rounded-xl cursor-pointer
border border-neutral-200 theme-dark:border-neutral-700
hover:bg-gradient-to-r hover:from-indigo-50 hover:to-purple-50
transition-all duration-300 ease-in-out shadow-md
hover:shadow-lg transform hover:scale-105 mb-2 active:scale-90 drawer-demo-card
"
>
<Box fullWidth className="flex justify-between items-center">
<p className="font-semibold text-lg text-neutral-800 theme-dark:text-white">
{item.title}
</p>
{!item.seen && (
<StatusBadge placement="right-bottom" />
)}
</Box>
<span className="text-neutral-600 text-sm theme-dark:text-neutral-500">
{item.message}
</span>
</Box>
)}
groupByKey={(item) => item.timestamp}
showKeyOnHead
renderKey={(key) => (
<h1
className="font-medium text-md"
style={{ color: colors.neutral[500] }}
>
{formatTime(new Date(key))}
</h1>
)}
/>
);
};
export default Drawer_Content;

Drawer

preventClose

Type:

boolean

Prevents the drawer component from closing when clicked outside

Default:

false
intensity

Type:

"none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"

Controls the intensity of the drop component backdrop.

Default:

sm
mode

Type:

"light" | "dark"

Sets the theme mode for the backdrop component.

Default:

system
value*

Type:

string

Provides the drawer's value, typically used for managing the active state.

Default:

className

Type:

string

Custom class for the Drawer

Default:

DrawerPanel

position

Type:

"left" | "right"

The drawer position

Default:

right
type

Type:

"float" | "sticky"

Drawer variant type

Default:

sticky
mode

Type:

"light" | "dark"

A shared theme mode across other drawer component ('Header','Footer')

Default:

system

DrawerHeader

showBorder

Type:

boolean

Adds border-bottom to the component.

Default:

true

DrawerContent

centerContent

Type:

boolean

Centers all it content

Default:

false
position

Type:

"left" | "right"

The drawer position

Default:

right
type

Type:

"float" | "sticky"

Drawer variant type

Default:

sticky
mode

Type:

"light" | "dark"

A shared theme mode across other drawer component ('Header','Footer')

Default:

system