feat: publish ColorField and shared color input parts
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import { shallowRef } from "vue";
|
||||
import type { Color } from "@heroui-vue/components";
|
||||
import {
|
||||
ColorField,
|
||||
ColorFieldGroup,
|
||||
ColorFieldInput,
|
||||
ColorFieldPrefix,
|
||||
ColorSwatch,
|
||||
Label,
|
||||
parseColor,
|
||||
} from "@heroui-vue/components";
|
||||
const color = shallowRef<Color | null>(parseColor("#0485F7"));
|
||||
</script>
|
||||
<template>
|
||||
<ColorField
|
||||
class="w-[280px]"
|
||||
name="color"
|
||||
as="div"
|
||||
data-custom="foo"
|
||||
v-slot="{ isFocused }"
|
||||
v-model="color"
|
||||
>
|
||||
<Label>颜色</Label>
|
||||
<ColorFieldGroup
|
||||
as="div"
|
||||
data-custom="foo"
|
||||
:data-field-focused="isFocused || undefined"
|
||||
>
|
||||
<ColorFieldPrefix>
|
||||
<ColorSwatch :color="color ?? undefined" size="xs" />
|
||||
</ColorFieldPrefix>
|
||||
<ColorFieldInput />
|
||||
</ColorFieldGroup>
|
||||
</ColorField>
|
||||
</template>
|
||||
Reference in New Issue
Block a user