Installation
Install the package
npm install srcdev-hair-treatmentsImport the styles
Two stylesheets ship in dist/: the component's own CSS, and a set of colour tokens it reads from. Import both once, globally, in your app's entry point or global CSS:
@import "srcdev-hair-treatments/dist/style.css";
@import "srcdev-hair-treatments/dist/tokens.css";tokens.css defines the four semantic colour ramps the component uses: --brand-00 through --brand-10, plus --success-*, --warning-* and --error-*. Skip this import and provide your own values instead if you want the widget themed to match your brand from the start — see Theming.
Register the plugin
createHairTreatments() is a Vue plugin that provides a default config to every TreatmentConsultant instance in your app. Passing a config here is optional — you can also pass one directly as a prop per-instance (see Configuration).
import { createApp } from "vue"
import { createHairTreatments } from "srcdev-hair-treatments"
import App from "./App.vue"
const app = createApp(App)
app.use(createHairTreatments())
app.mount("#app")Use the component
<template>
<TreatmentConsultant @complete="onComplete" />
</template>
<script setup lang="ts">
import { TreatmentConsultant } from "srcdev-hair-treatments"
import type { ConsultationSelections } from "srcdev-hair-treatments"
function onComplete(selections: ConsultationSelections) {
console.log(selections)
}
<\/script>Nuxt
Register the plugin under app/plugins/ (not a root-level plugins/ directory — Nuxt 4's default srcDir is app/, and a plugin outside it silently won't register):
// app/plugins/hair-treatments.ts
import { createHairTreatments } from "srcdev-hair-treatments"
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(createHairTreatments())
}) Add both stylesheets to nuxt.config.ts's css array, and wrap the component itself in <ClientOnly> — TreatmentConsultant is not SSR-safe. Full details in SSR & ClientOnly.