Files
heroui-vue/apps/docs/demos/color-area-controlled.vue
T

35 lines
763 B
Vue

<script setup lang="ts">
import { shallowRef } from "vue";
import {
ColorArea,
ColorAreaThumb,
ColorSwatch,
parseColor,
type Color,
} from "@heroui-vue/components";
const color = shallowRef<Color | null>(parseColor("#9B80FF"));
</script>
<template>
<div class="flex flex-col gap-4">
<ColorArea
v-model="color"
color-space="rgb"
x-channel="red"
y-channel="green"
>
<ColorAreaThumb />
</ColorArea>
<div class="flex w-[300px] items-center gap-3">
<ColorSwatch :color="color" size="md" />
<p class="text-sm text-muted">
Current color:
<span class="font-medium">
{{ color ? color.toString("hex") : "(empty)" }}
</span>
</p>
</div>
</div>
</template>