Tilt Card
让卡片朝指针方向倾斜,并在表面移动高光。
适用场景
- 当界面需要以下行为时使用 Tilt Card:让卡片朝指针方向倾斜,并在表面移动高光。
安装
选择安装方式,用法示例将同步更新导入路径。
$ bunx --bun shadcn-vue@2.8.2 add https://orvui.efu.me/r/tilt-card.json
首次使用时,将安装的 src/components/orvui/styles.css 导入项目样式入口。
示例
预览
Interactive
A new angle
Move across the surface to follow its depth and reflected light.
packages/vue/src/motion/tilt-card/demo.vue
<script setup lang="ts">
import { TiltCard } from "@/components/orvui/motion/tilt-card";
</script>
<template>
<div class="flex items-center justify-center p-6">
<TiltCard class="w-[280px] border border-border bg-card p-8">
<div class="text-xs uppercase tracking-wider text-muted-foreground">Interactive</div>
<h3 class="mt-2 text-2xl font-semibold text-foreground">A new angle</h3>
<p class="mt-3 text-sm text-muted-foreground">Move across the surface to follow its depth and reflected light.</p>
</TiltCard>
</div>
</template>
packages/vue/src/motion/tilt-card/src/TiltCard.vue
状态与事件
此示例组合没有声明成对的受控属性与 update 事件。使用已列出的属性、原生事件和插槽组合内容;不要为它添加未公开的 v-model。
API 参考
max?number12glare?booleantrue插槽
default() => VNodeChild#default无障碍
为交互控件提供明确的无障碍名称。保留文档中的键盘路径、可见焦点与减少动态效果状态;自定义插槽应继续保留所替代部件的语义。
常见问题
- 如何配置 Tilt Card?
- 通过 max、glare 配置 Tilt Card;API 表列出其类型与默认值。
- 如何连接到应用状态?
- 通过default 插槽提供内容,应用副作用由调用方管理。
- 可以在服务端渲染吗?
- 可以在 Vue SSR 应用中正常渲染。服务端与客户端的初始 props 应保持一致;浏览器测量与交互资源在挂载后启动。
更新于
来源与许可 ↗MIT · 0.1.1