atomico-jsx-patterns

Guide JSX patterns for type-safe Atomico web components.

1.3k|44|Updated Aug 25, 2018
One-click install
npx skills add https://github.com/atomicojs/atomico --skill atomico-jsx-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: atomico-jsx-patterns
Source: https://github.com/atomicojs/atomico/tree/main/.agents/skills/atomico-jsx-patterns
Command: npx skills add https://github.com/atomicojs/atomico --skill atomico-jsx-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide solves the common pitfalls and type-safety gaps when using JSX with Atomico by prescribing patterns that enable reliable prop and event inference, predictable shadow DOM and slot behavior, and maintainable component composition.

Core Features & Use Cases

  • Prefer constructor instances: Use constructor component references to preserve full TypeScript prop and event type checking, support IDE autocompletion, and enable safe refactoring.
  • Host and slot management: Enforce using host as the component root and apply default, named, and manual slot strategies to control light DOM composition and slot assignment.
  • Styling and performance patterns: Recommend CSS variable theming, inline style patterns, staticNode for frozen subtrees, keyed lists for efficient reconciliation, and inline event handlers for stronger inference.
  • Use Case: Build a typed Todo application where child components expose strongly-typed events and props and can be composed, refactored, and optimized without losing type safety.

Quick Start

Show me an Atomico example that composes a typed TodoApp using constructor component references, inline event handlers, and shadowDom with full TypeScript inference.

Frequently Asked Questions about atomico-jsx-patterns

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

FAQPage Schema
How do I write type-safe JSX patterns for Atomico web components?

To ensure type-safe prop and event inference in Atomico, use constructor component references rather than string tags. This preserves full TypeScript checking, supports IDE autocompletion, and enables safe refactoring when composing components.

What is the best way to manage slots and shadow DOM in Atomico components?

Managing slots and shadow DOM in Atomico involves enforcing the host as the component root and applying default, named, and manual slot strategies. This controls light DOM composition and ensures predictable slot assignment behavior within the shadow boundary.

How do I optimize rendering performance in Atomico JSX applications?

Optimizing rendering performance in Atomico involves using staticNode for frozen subtrees, keyed lists for efficient reconciliation, and inline event handlers for stronger type inference. CSS variable theming is also recommended for maintainable styling patterns.

Can I use TypeScript to infer events and props when composing Atomico components?

Yes, you can infer events and props when composing Atomico components by utilizing inline event handlers and constructor component references. This combination provides strong TypeScript inference, allowing child components to expose strongly-typed events and props throughout the application.

Does Atomico support CSS variable theming and inline styles for web components?

Atomico supports CSS variable theming and inline style patterns to provide maintainable styling for web components. These patterns allow developers to create predictable visual designs while maintaining type safety and developer-friendly refactoring capabilities.

Why should I use constructor references instead of string tags in Atomico JSX?

Using constructor references instead of string tags in Atomico JSX preserves full TypeScript prop and event type checking. String tags lose type inference, whereas constructor instances support IDE autocompletion and enable safe refactoring of component composition.