37 lines
1.0 KiB
Vue
37 lines
1.0 KiB
Vue
<script setup lang="ts">
|
|
import { shallowRef } from "vue";
|
|
import type { Color } from "@heroui-vue/components";
|
|
import {
|
|
ColorField,
|
|
ColorFieldGroup,
|
|
ColorFieldInput,
|
|
ColorFieldPrefix,
|
|
ColorSwatch,
|
|
Description,
|
|
Label,
|
|
parseColor,
|
|
} from "@heroui-vue/components";
|
|
const color = shallowRef<Color | null>(parseColor("#6366F1"));
|
|
</script>
|
|
<template>
|
|
<ColorField
|
|
class="w-full max-w-xs gap-1.5"
|
|
name="accent-color"
|
|
v-model="color"
|
|
>
|
|
<Label class="font-medium text-foreground">强调色</Label>
|
|
<Description>应用于按钮、链接和焦点环。</Description>
|
|
<ColorFieldGroup
|
|
class="rounded-xl bg-default shadow-none focus-within:ring-2 focus-within:ring-accent/15"
|
|
variant="secondary"
|
|
>
|
|
<ColorFieldPrefix>
|
|
<ColorSwatch class="rounded-md" :color="color ?? undefined" size="xs" />
|
|
</ColorFieldPrefix>
|
|
<ColorFieldInput
|
|
class="font-mono text-sm text-foreground placeholder:text-muted"
|
|
/>
|
|
</ColorFieldGroup>
|
|
</ColorField>
|
|
</template>
|