Dynamic Components

Teaches dynamic component switching with Vue's <component> element. Use when you need to render different components conditionally based on runtime state using the is attribute.

259 stars 28 forksFrontend & Design

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add PatternsDev/skills --skill dynamic-components
Manual install
git clone --depth 1 https://github.com/PatternsDev/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/vue/dynamic-components ~/.claude/skills/dynamic-components

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Dynamic Components

## Table of Contents

- [When to Use](#when-to-use)
- [Instructions](#instructions)
- [Details](#details)
- [Source](#source)

Dynamic components constitute the ability to dynamically change (i.e. switch) between components by binding an `is` attribute to the reserved `<component>` element.

We'll go through an example to best understand how dynamic components work. Assume we have separate components titled `Home`, `Feed`, and `History` that simply display text dictating what component it is.

## When to Use

- Use this when you need to render different components based on user interaction (e.g., tabs, views)
- This is helpful as an alternative to multiple `v-if`/`v-else` blocks for conditional component rendering

## Instructions

- Bind the `is` attribute on `<component>` to a reactive value referencing the component definition
- Use a `tabs` object mapping names to imported component definitions
- Wrap `<component>` with `<KeepAlive>` to preserve state when switching between dynamic components

## Details

```html

<template><div class="tab">Home component</div></template>

<template><div class="tab">Feed component</div></template>

<template><div class="tab">History component</div></template>
```

Our goal is to build an interface that surfaces a list of tabs that can be clicked. Depending on what tab is clicked, we want to dynamically render a certain component.
Read the full skill on GitHub

Details

Skill name
dynamic-components
Path
vue/dynamic-components/SKILL.md
Repo updated
15 April 2026

FAQ

What does the Dynamic Components skill do?

Teaches dynamic component switching with Vue's <component> element. Use when you need to render different components conditionally based on runtime state using the is attribute.

How do I install the Dynamic Components skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add PatternsDev/skills --skill dynamic-components. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Dynamic Components popular?

It lives in PatternsDev/skills, which has 259 GitHub stars and 28 forks.

Related skills

Browse the most popular Claude skills, all frontend & design skills, or write your own with the skills generator.