Skip to main content

Drawer

The Drawer component is a flexible UI element that slides in from a specified direction and displays content such as text, images, and buttons. It can be customized with various props for styling and behavior.

Import

import { Drawer } from 'pristineui';

Usage

/src/components/Drawer.jsx
import Drawer from 'pristineui';

const Drawer = () => (
<Drawer
headerText="Elanine Creatives"
description="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy."
image={camera}
className="bg-dark"
direction="bottom"
buttonDisplay={true}
>
{/* Children content goes here */}
</Drawer>
);

export default Drawer;

Props

Prop NameTypeDescriptionDefault
headerTextstringThe text displayed as the header of the drawer.""
descriptionstringThe text displayed as the description inside the drawer.""
imagestringThe URL or image path for the image displayed in the drawer.null
classNamestringCustom CSS class for additional styling.""
direction'left' | 'right' | 'top' | 'bottom'The direction from which the drawer will slide in.'left'
buttonDisplaybooleanWhether a button should be displayed inside the drawer.false
childrenReactNodeAny children elements to render inside the drawer.null

Possible Values:

  • 'left': The drawer will slide in from the left side of the screen.
  • 'right': The drawer will slide in from the right side of the screen.
  • 'top': The drawer will slide down from the top of the screen.
  • 'bottom': The drawer will slide up from the bottom of the screen.

buttonDisplay Prop

When true, a button will be displayed inside the drawer. You can customize its label or functionality by passing button-related content as children.

Customization

You can further customize the Button using CSS classes and inline styles.