Skip to content

Input Color ​

Base color-input form.

Usage ​

Simple Usage ​

preview
vue
<template>
  <p-input-color />
</template>

Variant ​

Input color also available with variant circle. When variant is not set, input color will looks as default.

preview
vue
<template>
  <p-input-color variant="circle" />
</template>

Disabled state ​

preview
vue
<template>
  <p-input-color disabled />
</template>

Error state ​

preview
vue
<template>
  <p-input-color error />
</template>

Binding v-model ​

preview
Result:
vue
<template>
  <p-input-color v-model="color" />
</template>

<script lang="ts" setup>
  const color = ref('')
</script>

Clearable ​

Clear button are hidden by default. To show clear button, you can set clearable to true.

Default clearable ​

preview
vue
<template>
  <p-input-color clearable v-model="color" />
</template>

Custom clearable ​

preview
vue
<template>
  <p-input-color clearable v-model="color">
    <template #clearable="{ clear }">
      <p-button
        :disabled="!color"
        style="--p-button-sm-padding-x: 0"
        size="sm"
        variant="link"
        @click="clear">Reset</p-button>
    </template>
  </p-input-color>
</template>

API ​

Props ​

PropsTypeDefaultDescription
variantString-Input color style variant, valid value: default and circle
disabledBooleanfalseDisabled state
errorBooleanfalseError state
clearableBooleanfalseEnable clear button
modelValueString-v-model value
container-classString or Object-CSS class to add in the input color container

Slots ​

NameDescription
clearableContent to place custom clear action of input color

Events ​

NameArgumentsDescription
clear-Event when clear button clicked

Released under the MIT License.