-
Notifications
You must be signed in to change notification settings - Fork 3
Creating New Customization Inputs
Salwa Jeries edited this page Mar 23, 2026
·
1 revision
Customization input components are designed to handle a specific visualization customization property and save these inputs in the VizWizStore.
- Set a default value for the input in a local ref
- Create a
watchfor changes to the input value to update theVizWizStore - Setup
onMountedto load a saved value (if applicable in "edit visualization") from theVizWizStore - Create the actual input component in the component template
Input validation may not be required for the component if a value is always selected (i.e. it cannot be set to empty). However, if validation is required it should be handled by the useComponentValidation hook with defined VisualizationComponentEmits emits.
const emit = defineEmits<VisualizationComponentEmits>()
useComponentValidation(valid, emit) // Assume valid = computed boolean of validation state
Below is the BackgroundColorControl.vue to configure background color:
<script setup lang="ts">
import { watch, ref, onMounted } from 'vue';
import { useVizWizStore } from '@/stores/vizwizstore';
const vwStore = useVizWizStore();
const backgroundColor = ref<string>('#ff0000ff');
watch(backgroundColor, (val) => {
vwStore.updateVisualizationCustomizationOptions({ backgroundColor: val });
});
onMounted(() => {
if (!vwStore.visualizationCustomizationOptions.backgroundColor) {
vwStore.updateVisualizationCustomizationOptions({
backgroundColor: backgroundColor.value,
});
} else {
backgroundColor.value = vwStore.visualizationCustomizationOptions.backgroundColor
}
});
</script>
<template>
<h3>Background Color</h3>
<v-color-picker style="margin: auto" v-model="backgroundColor" mode="rgba"> </v-color-picker>
</template>
Troubleshooting
Developer Documentation