For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/drawer.md.
v0.0.57
  • 简体中文
  • Drawer

    反馈@rockshin/tao-ui

    在不离开当前页面的情况下打开侧边任务面板。

    何时使用

    检查、编辑或辅助工作流需要保留当前页面上下文时使用 Drawer。

    推荐

    • 提供清晰标题和可预测的关闭入口。
    • 破坏性操作应保留独立确认步骤。

    避免

    • 不要在同一工作流中连续堆叠多个 Drawer。

    代码演示

    基础用法

    TSX

    位置与尺寸

    TSX

    页脚与额外操作

    TSX

    可调整尺寸的抽屉

    TSX

    预设与自定义尺寸

    size 提供预设,width 或 height 可指定应用所需的尺寸。

    TSX

    遮罩与关闭方式

    分别控制遮罩、点击遮罩关闭和关闭按钮,始终提供明确的退出路径。

    TSX

    拖动调整抽屉

    resizable 允许拖动边缘调整尺寸,适合需要临时扩大工作区域的详情面板。

    TSX

    API

    Drawer

    属性说明类型默认值
    extraExtra content rendered on the trailing side of the header.ReactNode-
    footerFooter content; renders a bordered footer area when provided.ReactNode-
    sizePreset drawer size: default (378) / large (736). width/height override it.DrawerSize | undefined-
    closableShow the close (×) button. Defaults to true.boolean | undefinedtrue
    closeIconCustom close icon.ReactNode-
    maskClosableClose when clicking the mask. Defaults to true.boolean | undefinedtrue
    maskRender the mask/overlay. Defaults to true.boolean | undefinedtrue
    keyboardClose on Esc key. Defaults to true.boolean | undefinedtrue
    resizableAllow resizing by dragging the inner edge. Pass an object for resize callbacks.boolean | DrawerResizableConfig | undefined-
    afterOpenChangeCalled after open transitions in either direction.((open: boolean) => void) | undefined-
    afterCloseCalled after the drawer has fully closed.(() => void) | undefined-
    destroyOnHiddenUnmount children when closed. Defaults to true. Set false to keep children mounted while releasing modal interaction locks when hidden.boolean | undefinedtrue