Sheet

Description

The Sheet component is a side modal that can slide in and out from the left or right side of the screen. It serves as the main container for managing state and logic, while the Sheet.Trigger acts as the interactive element to open the Sheet, and the Sheet.Content holds the content, allowing customization of its position.

Usage

Account

Make changes to your account here. Click save when you're done.


import { Sheet, Input, Button } from "mogora-ui";

export default function SheetDemo() {
  return (
    <Sheet>
      <Sheet.Trigger>
        <Button variant={"clicki"}>Sheet</Button>
      </Sheet.Trigger>
      <Sheet.Content position="left" className="w-72 flex flex-col gap-2">
        <h1 className="text-start font-bold w-full">Account</h1>
        <p className="text-sm leading-4 font-medium text-slate-500">
          Make changes to your account here. Click save when you're done.
        </p>
        <Input className="focus:ring-slate-500" theme={"info"} placeholder="Email" />
        <Input className="focus:ring-slate-500" theme={"info"} placeholder="Username" />
      </Sheet.Content>
    </Sheet>
  )
}

API Reference

Sheet

The main component for managing the Sheet.

PropTypeDescription
childrenReactNodeElements to be rendered inside the Sheet.
openbooleanDetermines whether the Sheet is open or not.
onOpenChange(open: boolean) => voidCallback function triggered when the Sheet state changes.
classNamestringAdditional classes for styling.

Sheet.Trigger

The trigger component used to open the Sheet.

PropTypeDescription
childrenReactNodeThe element that can be clicked to open the Sheet.
classNamestringAdditional classes for styling.

Sheet.Content

The component that displays the Sheet content.

PropTypeDescription
childrenReactNodeContent to be displayed inside the Sheet.
classNamestringAdditional classes for styling.
position"left" | "right"Determines the position of the Sheet (left or right).