Skip to content
Back to skills

Vue Renderless Components

ASecurity

> Extract behavior into components that render nothing, delegating all rendering to the consumer via slots

  • 20 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 11, 2026
developmentgoreactvue

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add Intense-Visions/harness-engineering --skill vue-renderless-components --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vue Renderless Components?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vue Renderless Components
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/intense-visions-vue-renderless-components/badge)](https://www.skillsdirectory.com/skills/intense-visions-vue-renderless-components)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Vue Renderless Components

> Extract behavior into components that render nothing, delegating all rendering to the consumer via slots

## When to Use

- You want to share complex behavior (toggle, fetch, form validation) without dictating the UI
- Building a component library where consumers control all markup and styling
- Porting Vue 2 patterns where composables were not available

## Instructions

1. Create a component that manages state and behavior but renders nothing itself.
2. Use `<slot v-bind="slotProps">` to pass data and actions to the parent via scoped slots.
3. The consumer provides all markup via the default slot, receiving behavior via slot props.
4. Prefer composables for new code — renderless components are the Vue 2 equivalent.

```vue
<!-- RenderlessToggle.vue -->
<script setup>
import { ref } from 'vue';
const isOpen = ref(false);
const toggle = () => {
  isOpen.value = !isOpen.value;
};
</script>

<template>
  <slot :isOpen="isOpen" :toggle="toggle" />
</template>
```

5. Use in the consumer: `<RenderlessToggle v-slot="{ isOpen, toggle }">`.

## Details

Renderless (headless) components separate behavior from presentation. The component owns the logic (state, side effects, event handling) and exposes it via scoped slots. The consumer owns the template. This is the Vue equivalent of React's render props pattern.

**Trade-offs:**

- Scoped slot syntax is more verbose than calling a composable function
- Harder to compose — nesting multiple renderless components leads to "slot callback hell"
- In Vue 3, composables achieve the same goal with simpler syntax

**When NOT to use:**

- In new Vue 3 projects — use composables instead, which are simpler and more composable
- When the behavior is trivial — a `ref` inline in `<script setup>` is clearer
- When the component needs specific DOM structure — it is not truly renderless

## Source

https://patterns.dev/vue/renderless-components

## Process

1. Read the instructions and examples in this document.
2. Apply the patterns to your implementation, adapting to your specific context.
3. Verify your implementation against the details and edge cases listed above.

## Harness Integration

- **Type:** knowledge — this skill is a reference document, not a procedural workflow.
- **No tools or state** — consumed as context by other skills and agents.

## Success Criteria

- The patterns described in this document are applied correctly in the implementation.
- Edge cases and anti-patterns listed in this document are avoided.

Files in this skill

  • SKILL.md2.5 KB
  • skill.yaml700 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.