composition

Compose rikka UI from function components and custom elements.

6|1|Updated May 31, 2026
One-click install
npx skills add https://github.com/yw662/rikka --skill composition-yw662
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: composition
Source: https://github.com/yw662/rikka/tree/main/skills/composition
Command: npx skills add https://github.com/yw662/rikka --skill composition-yw662

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you structure rikka user interfaces into reusable pieces without forcing every part of the app into one component style. It is useful when you need to decide between lightweight function-based composition and registered custom elements, or when you want both to work together cleanly.

Core Features & Use Cases

  • Composable Functions: Build UI from plain functions that return Elements for fast, zero-ceremony reuse.
  • Custom Elements: Define real Web Components with attributes, events, Shadow DOM, and DOM-level identity.
  • Bridge Between Styles: Use the generated .h helper to embed a custom element like a tag helper inside another composition.
  • Practical Use Cases: Split a dashboard into cards, badges, counters, and nested widgets while mixing reusable helpers and registered elements.

Quick Start

Use this Skill when you want to compose a rikka interface by combining function components and custom elements in the same view.

Frequently Asked Questions about composition

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

FAQPage Schema
How do I compose web components and function components in the same UI view?

Composing web components and function components in the same UI view involves combining plain functions returning Elements with registered custom elements, using a generated .h helper to bridge them as tag-like helpers.

What is the best way to split a web interface into reusable custom elements and nested layouts?

The best way to split an interface into reusable custom elements and nested layouts is by defining Web Components with Shadow DOM and DOM-level identity, then composing them with lightweight function components.

Does this composition approach support type-safe attribute and event passing for custom elements?

Yes, the composition approach fully supports type-safe attribute and event passing, ensuring custom elements and function components exchange data with strict type safety during UI composition.

Can I use Shadow DOM with function components or only with registered custom elements?

Shadow DOM support applies to registered custom elements to provide DOM-level identity and encapsulation, while function components provide a lightweight, zero-ceremony alternative for fast reuse.

When should I choose function components over custom elements for building reusable UI?

Choose function components for lightweight, zero-ceremony reuse via plain functions returning Elements; choose custom elements when you need DOM-level identity, attributes, events, and Shadow DOM encapsulation.

How do I embed a registered custom element inside a function component layout?

You embed a registered custom element inside a function component layout by using the generated MyElement.h bridge helper, which allows registered elements to function as tag-like helpers within compositions.