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

26 lines
671 B
Vue

<script setup lang="ts">
import { ColorSwatch } from "@heroui-vue/components";
const colors = [
{ color: "#0485F7", label: "蓝色", name: "blue" },
{ color: "#EF4444", label: "红色", name: "red" },
{ color: "#F59E0B", label: "琥珀色", name: "amber" },
{ color: "#10B981", label: "绿色", name: "green" },
{ color: "#D946EF", label: "品红", name: "fuchsia" },
];
</script>
<template>
<div class="flex items-center gap-3">
<ColorSwatch
v-for="item in colors"
:key="item.color"
:color="item.color"
:aria-label="item.label"
as-child
>
<div :data-custom="item.name" />
</ColorSwatch>
</div>
</template>