Files
heroui-vue/apps/docs/demos/color-swatch-custom-styles.vue
T
2026-10-26 13:25:21 +08:00

40 lines
1.0 KiB
Vue

<script setup lang="ts">
import { ColorSwatch } from "@heroui-vue/components";
const colors = ["#0485F7", "#EF4444", "#F59E0B", "#10B981", "#D946EF"];
</script>
<template>
<div class="flex flex-col gap-8">
<div class="flex flex-col gap-2">
<span class="text-sm text-muted">发光效果</span>
<div class="flex items-center gap-4">
<ColorSwatch
v-for="color in colors"
:key="color"
:color="color"
size="xl"
:style-fn="() => ({ boxShadow: `0 0 20px 2px ${color}` })"
/>
</div>
</div>
<div class="flex flex-col gap-2">
<span class="text-sm text-muted">渐变</span>
<div class="flex items-center gap-4">
<ColorSwatch
v-for="color in colors"
:key="color"
:color="color"
size="xl"
:style-fn="
({ color: current }) => ({
background: `linear-gradient(135deg, ${current.toString('css')}, white)`,
})
"
/>
</div>
</div>
</div>
</template>