Skip to content

HueyRoot

The required root wrapper for all Huey components. It holds the shared color state and provides it via context to every child component. All Huey components must be rendered inside it.

HueyRoot accepts either a plain string (any format hueyColor() understands, e.g. #1A3263, rgb(...), hsl(...)) or a HueyColor instance.

import { HueyRoot } from '@hueycolor/vue'
<script setup>
import { ref } from 'vue'
import { HueyRoot, HexInput } from '@hueycolor/vue'
const color = ref('#1A3263')
</script>
<template>
<HueyRoot v-model="color">
<HexInput />
</HueyRoot>
</template>

If you’d rather work with a HueyColor instance directly, wrap your value with hueyColor():

<script setup>
import { ref } from 'vue'
import { HueyRoot, hueyColor } from '@hueycolor/vue'
const color = ref(hueyColor('#1A3263'))
</script>
Prop Type Default Description
color / v-model string | HueyColor The reactive color value. In Vue, pass as v-model. In Svelte, pass as bind:color. Required.

HueyRoot renders no DOM element of its own. It only provides context. You can wrap it in any layout element without affecting the output structure.

When you pass a string, the bound value stays a string in the same format you provided. Pass a HueyColor if you want the bound value to be a HueyColor instance.