Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple helper to create functional Vue components with CSS modules and Typescript.
import { componentFactory } from 'vue-tsx-support';
import { VNode } from 'vue';
type Styles = string | Array<string>;
interface WrapperProps {
as?: string;
export default (
styles: Styles,
tag: string = 'div',
) => componentFactory.create<object & WrapperProps, {}>({
functional: true,
render(h, context): VNode {
const { props, children, data } = context;
const elementName = tag ||;
return h(elementName, { attrs: data.attrs, props, class: styles }, children);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.