# preact-custom-element **Repository Path**: mirrors_developit/preact-custom-element ## Basic Information - **Project Name**: preact-custom-element - **Description**: Wrap your component up as a custom element - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # preact-custom-element Generate/register a custom element from a preact component. ## Usage Import `CustomElement` and call with your component and a tag name: ```javascript import registerCustomElement from "preact-custom-element"; const Greeting = ({ name = "World" }) => (
Hello, {name}!
); registerCustomElement(Greeting, "x-greeting"); ``` Use the new tag name in HTML, attribute keys and values will be passed in as props: ```htmlHello, Billy Jo!
``` ## Related [preact-shadow-dom](https://github.com/bspaulding/preact-shadow-dom)