dynamic-components

Switch Vue components dynamically using the is binding and KeepAlive.

235|25|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/PatternsDev/skills --skill dynamic-components
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dynamic-components
Source: https://github.com/PatternsDev/skills/tree/main/vue/dynamic-components
Command: npx skills add https://github.com/PatternsDev/skills --skill dynamic-components

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rendering different components based on runtime state without switching routes can complicate UIs and degrade user experience. This Skill provides a straightforward pattern to swap components using Vue's <component> element and the is binding, while optionally preserving state with KeepAlive.

Core Features & Use Cases

  • Dynamic component switching using the is attribute on the <component> element to render Home, Feed, History, or other components based on user interaction.
  • State preservation across switches with <KeepAlive>, ensuring user inputs and internal state remain intact when changing views.
  • Clear integration pattern: import component definitions, map them in a tabs-like object, and render the active one with a single binding.

Quick Start

Launch the Vue app and set currentTab to Home (or Feed/History) to see dynamic components render and switch without routing.

Frequently Asked Questions about dynamic-components

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I switch Vue components dynamically without routing?▼

Switch Vue components dynamically without routing by binding the component definitions to a reactive selector and rendering the active view through Vue's <component> element with the is attribute.

What is the best way to switch tabs in Vue and preserve user input state?▼

Switch tabs and preserve user input state by rendering dynamic components inside Vue's <KeepAlive> wrapper, ensuring internal state remains intact when changing views without routing.

How does the Vue is attribute work for rendering dynamic components?▼

The Vue is attribute works for rendering dynamic components by accepting a component definition from a mapping object, instructing the <component> element to render the matching view based on runtime state.

Does Vue KeepAlive work with dynamic components to cache view state?▼

Vue KeepAlive works with dynamic components to cache view state by optionally wrapping the <component> element, ensuring user inputs and internal state are preserved across view switches.

When should I use dynamic components instead of Vue Router for view switching?▼

Use dynamic components instead of Vue Router for view switching when you need a lightweight single-page UI pattern, like tabs, without changing the URL or setting up a full routing configuration.