命令面板

搜索要执行的命令…

0GitHub 星标
Components

滑动操作

滑动列表中的一行即可显示左侧或右侧的操作。

加载中

功能

构建于 React 滑动操作 之上。

  • 用指针或触摸拖动。
  • 距离或轻轻一按即可打开。完全滑动会运行最外面的操作。
  • 一次仅打开一行,通过外部点击即可关闭。

安装

pnpm dlx shadcn@latest add @yourname/swipe-actions

用法

import {
  SwipeAction,
  SwipeActions,
  SwipeContent,
  SwipeItem,
  SwipeRoot,
} from "@/components/swipe-actions"
<SwipeRoot>
  <SwipeItem>
    <SwipeActions side="right" fullSwipe>
      <SwipeAction />
      <SwipeAction />
    </SwipeActions>
 
    <SwipeContent />
  </SwipeItem>
</SwipeRoot>

成分

使用以下组合构建 SwipeItem

SwipeRoot
└── SwipeItem
    ├── SwipeActions
    │   └── SwipeAction
    └── SwipeContent

示例

最小

有效的最小设置:一侧执行一个操作。

加载中

选择完整的滑动动作

完全滑动会执行最外层的操作,因此请与安全的一起订购该条带 最后。此处“删除”位于该行旁边,但仍需要刻意点击。

加载中

无障碍

  • 箭头键打开聚焦行,Escape 关闭它。
  • 封闭的条带是inert,因此他们的动作无法触及。
  • 尊重prefers-reduced-motion。

参考

License and usage

  • Free to use and modify in both personal and commercial projects.
  • Attribution is appreciated but not required.
  • Released under the MIT License.

这个页面对你有帮助吗?

命令面板

搜索要执行的命令…