GitPedia

Mount vue component

a tiny utility to programatically create and mount Vue 3 components (e.g. a Vue.extend replacement)

From pearofducks·Updated February 13, 2026·View on GitHub·

- `component`: required, the component to be created/mounted - `props`: props to be passed onto the component, this can include HTML attributes like `id` or `class` - `children`: components to be rendered as children of `component` - `element`: if specified, the element to mount the component into, if not specified, a `div` will be created - `app`: the Vue app instance from `createApp`, if provided will be bound to the component's `appContext` The project is written primarily in JavaScript, distributed under the MIT License license, first published in 2020. Key topics include: component, extend, vue-3.

Latest release: v0.10.0More compatible syntax, and change to type: module
May 15, 2021View Changelog →

mount-vue-component

install

shell
yarn add mount-vue-component

use

js
import { mount } from 'mount-vue-component' import { h } from 'vue' const comp = { props: ['name'], setup: (props) => () => h('h1', `Hello, ${props.name}!`), unmounted() { console.log("Bye") }, mounted() { console.log("Hi") } } const { vNode, destroy, el } = mount(comp, { props: { name: 'world' } })

api

mount(component, { props, children, element, app })

  • component: required, the component to be created/mounted
  • props: props to be passed onto the component, this can include HTML attributes like id or class
  • children: components to be rendered as children of component
  • element: if specified, the element to mount the component into, if not specified, a div will be created
  • app: the Vue app instance from createApp, if provided will be bound to the component's appContext
returns { vNode, destroy, el }
  • vNode: the instance of the component provided
  • destroy: a function that will unmount and destroy the component
  • el: will provide the HTML element the component is mounted into

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from pearofducks/mount-vue-component via the GitHub API.Last fetched: 6/14/2026