reablocks
Version:
Component library for React
90 lines (89 loc) • 2.65 kB
TypeScript
import { FC, ReactElement, ReactNode } from 'react';
import { GlobalOverlayProps } from '../../utils/Overlay';
import { MotionNodeAnimationOptions, MotionProps, TargetAndTransition, Transition, VariantLabels } from 'motion/react';
import { DrawerHeader, DrawerHeaderProps } from './DrawerHeader';
import { DrawerTheme } from './DrawerTheme';
export interface DrawerProps extends Omit<GlobalOverlayProps, 'children'>, MotionProps {
/**
* Position of the drawer.
* @default 'end'
*/
position?: 'start' | 'end' | 'top' | 'bottom';
/**
* Size of the drawer.
* @default '80%'
*/
size?: string | number;
/**
* CSS class name for the drawer.
*/
className?: string;
/**
* CSS class name for the content of the drawer.
*/
contentClassName?: string;
/**
* CSS class name for the backdrop of the drawer.
*/
backdropClassName?: string;
/**
* Whether to disable padding for the drawer content.
* @default false
*/
disablePadding?: boolean;
/**
* The header of the drawer.
* @deprecated Use DrawerHeader slot component instead.
* @example
* // Instead of:
* <Drawer header="My Title">...</Drawer>
*
* // Use:
* <Drawer>
* <DrawerHeader>My Title</DrawerHeader>
* <DrawerContent>...</DrawerContent>
* </Drawer>
*/
header?: ReactNode;
/**
* Whether to show the close button.
* @default true
*/
showCloseButton?: boolean;
/**
* The content of the drawer.
* Supports slot-based approach with DrawerHeader, DrawerContent, and DrawerFooter.
*/
children?: ReactNode;
/**
* The React element for the drawer header.
* @deprecated Use DrawerHeader slot component instead.
* @default <DrawerHeader />
*/
headerElement?: ReactElement<DrawerHeaderProps, typeof DrawerHeader> | null;
/**
* Theme for the Drawer.
*/
theme?: DrawerTheme;
/**
* @deprecated Use animation configuration instead.
*/
initial?: TargetAndTransition | VariantLabels | boolean;
/**
* @deprecated Use animation configuration instead.
*/
animate?: TargetAndTransition | VariantLabels | boolean;
/**
* @deprecated Use animation configuration instead.
*/
exit?: TargetAndTransition | VariantLabels;
/**
* @deprecated Use animation configuration instead.
*/
transition?: Transition;
/**
* Animation configuration for the drawer.
*/
animation?: MotionNodeAnimationOptions;
}
export declare const Drawer: FC<Partial<DrawerProps>>;