Vue Component Wrappers

Updated:

This feature is experimental within the Stencil Library (Docs) and is automated within their build process. Please report any issues encountered. However, note that the Tecton team does not maintain this specific tool.

This tutorial assumes your codebase is registering the Web Components via connect from the q2-tecton-sdk, or from the q2-design-system library (Guide).

If you're using Vue to build out your feature or application, then you can make use of the Vue component wrappers that are published as a part of Tecton.

This gives you a number of benefits including:

  • Autocompletion
  • Better event handling
  • Type safety

Getting started

Making use of the Vue component wrappers only requires a couple of steps.

First, you will need to install the framework wrappers library:

  • NPM: npm i q2-tecton-framework-wrappers
  • Yarn: yarn add q2-tecton-framework-wrappers

Using the components

Once the package is installed you can start using the components by importing the ones you need, just like you would with any other components. They are all located in q2-tecton-framework-wrappers/dist/vue.

<script lang="ts">
import { defineComponent } from "vue";
import { 
  Q2Input, 
  Q2Section, 
  Q2Btn
} from "q2-tecton-framework-wrappers/dist/vue";

export default defineComponent({
  components: { Q2Input, Q2Section, Q2Btn },
  methods: {
    onFullNameInput(event: CustomEvent<{ value: string }>) {
      console.log(event.detail.value);
    },
  },
});
</script>

<template>
  <q2-section label="My Section" collapsible expanded>
    <q2-input label="Full name" optional @input="onFullNameInput" />
    <q2-btn intent="workflow-primary">Submit</q2-btn>
  </q2-section>
</template>