MotionIcon 动效图标
在指针经过时为图标添加动效。
基础用法
将图标放入默认插槽。开启系统的减少动态效果偏好时,动效会停用。
查看代码收起代码
vue
<script setup lang="ts">
import { ZMotionIcon } from '@codex-proxy/ui'
import { Box, Sparkles } from '@lucide/vue'
</script>
<template>
<div class="demo-row">
<ZMotionIcon class="inline-grid size-14 place-items-center rounded-z-lg bg-z-fill-tertiary text-z-primary-text">
<Box :size="28" />
</ZMotionIcon>
<ZMotionIcon variant="brand" class="inline-grid size-14 place-items-center rounded-z-lg bg-z-fill-tertiary text-z-primary-text">
<Sparkles :size="28" />
</ZMotionIcon>
<span>移动指针查看反馈,系统减少动态效果时不播放</span>
</div>
</template>MotionIcon API
属性
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
as | 根元素标签 | keyof HTMLElementTagNameMap | 'span' |
variant | 随机反馈或固定品牌动效 | 'random' | 'brand' | 'random' |
插槽
| 插槽 | 说明 |
|---|---|
default | 需要动效的图标内容 |