/react-19:supporting-custom-elementsfrom react-19
Teaches Web Components (Custom Elements) support in React 19, including property vs attribute handling and custom events. Use when integrating Web Components or working with custom HTML elements.
Ships in react-19. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
New in React 19:
on + EventName conventionBefore React 19:
<web-counter
ref={(el) => {
if (el) {
el.increment = increment;
el.isDark = isDark;
}
}}
/>
React 19:
<web-counter increment={increment} isDark={isDark} onIncrementEvent={() => setCount(count + 1)} />
## Using Web Components
Step 1: Define Custom Element (or use third-party)
class WebCounter extends HTMLElement {
connectedCallback() {
this.render();
}
set increment(fn) {
this._increment = fn;
}
set isDark(value) {
this._isDark = value;
this.render();
}
handleClick() {
this._increment?.();
this.dispatchEvent(new CustomEvent('incremented'));
}
render() {
this.innerHTML = `
<button style="color: ${this._isDark ? 'white' : 'black'}">
Increment
</button>
`;
this.querySelector('button').onclick = () => this.handleClick();
}
}
customElements.define('web-counter', WebCounter);
Step 2: Use in React 19
function App() {
const [count, setCount] = useState(0);
const [isDark, setIsDark] = useState(false);
const increment = () => setCount(count + 1);
return (
<div>
<p>Count: {count}</p>
<web-counter
increment={increment}
isDark={isDark}
onIncremented={() => console.log('Incremented!')}
/>
<button onClick={() => setIsDark(!isDark)}>Toggle Theme</button>
</div>
);
}
Step 3: Handle Custom Events
Custom events follow on + EventName convention:
<my-button label="Click Me" onButtonClick={handleClick} />
If custom element dispatches buttonClick event, React automatically wires it up.
import '@material/mwc-button';
function MaterialButton() {
return <mwc-button raised label="Click me" icon="code" onClick={() => alert('Clicked!')} />;
}
class RatingInput extends HTMLElement {
connectedCallback() {
this.rating = 0;
this.render();
}
setRating(value) {
this.rating = value;
this.dispatchEvent(
new CustomEvent('ratingChange', {
detail: { rating: value },
})
);
this.render();
}
render() {
this.innerHTML = `
${[1, 2, 3, 4, 5]
.map(
(i) => `
<button data-rating="${i}">⭐</button>
`
)
.join('')}
`;
this.querySelectorAll('button').forEach((btn) => {
btn.onclick = () => this.setRating(+btn.dataset.rating);
});
}
}
customElements.define('rating-input', RatingInput);
function ReviewForm() {
const [rating, setRating] = useState(0);
return (
<form>
<rating-input onRatingChange={(e) => setRating(e.detail.rating)} />
<p>Rating: {rating}</p>
</form>
);
}
For comprehensive Custom Elements documentation, see: research/react-19-comprehensive.md lines 1034-1089.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub djankies/claude-configs --plugin react-1926 skills in this plugin
/composing-componentsTeaches component composition patterns in React 19 including children prop, compound components, and render props. Use when designing component APIs, creating reusable components, or avoiding prop drilling./following-the-rules-of-hooksFix React Rules of Hooks violations - conditional calls, hooks in loops/callbacks/classes/implementing-code-splittingTeaches code splitting with lazy() and Suspense in React 19 for reducing initial bundle size. Use when implementing lazy loading, route-based splitting, or optimizing performance.Other plugins' skills for the same job