Drawer
Overview
Drawer is a design-system component intended for reusable, product-agnostic UI composition.
Import
import { Drawer } from "@tesseract-nexus/tesserix-ui"Exports
export { Drawer } from "./drawer"
export type { DrawerProps } from "./drawer"Props
export interface DrawerProps {
open?: boolean
defaultOpen?: boolean
onOpenChange?: (open: boolean) => void
children?: React.ReactNode
}Variations
const drawerContentVariants = cva(
"fixed z-50 gap-4 bg-card p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
{
variants: {
side: {
top: "inset-x-0 top-0 border-b rounded-b-lg data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
bottom:
"inset-x-0 bottom-0 border-t rounded-t-lg data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
left: "inset-y-0 left-0 h-full w-3/4 border-r rounded-r-lg data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left max-w-sm",
right:
"inset-y-0 right-0 h-full w-3/4 border-l rounded-l-lg data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right max-w-sm",
},
},
defaultVariants: {Usage Patterns
Basic
import { Drawer } from "@tesseract-nexus/tesserix-ui"
export function Example() {
return <Drawer />
}Do / Don’t
Do
// Compose with domain wrappers in product code
<Drawer className="w-full" />Don’t
// Avoid one-off hardcoded values that bypass tokens
<Drawer className="bg-[#123456] text-[#fafafa] px-[13px]" />Token / Theming Mapping
- Color tokens: —primary, —secondary, —muted, —destructive, —foreground, —background
- Shape tokens: —radius
- Border/input tokens: —border, —input, —ring
- Spacing and typography: Tailwind scale via design-system preset
Interaction Test Checklist
- Interaction: click/keyboard activation for primary paths.
- Focus: visible focus styles and logical tab order.
- Variants: core variants and sizes render correctly.
- Disabled/error states: behavior and ARIA attributes are correct.
- Regression: Storybook visual check for primary states.
Accessibility
- Verify keyboard behavior for all interactive states.
- Ensure labels and semantic roles are present in consuming screens.
- Validate focus treatment and screen-reader output during QA.