Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jahilldev/component-elements
Create a custom element from any component with these tiny functions (2KB GZipped, ~1KB Brotli). Preact and React currently supported
https://github.com/jahilldev/component-elements
components custom-elements hydration javascript jsx library lightweight nodejs partial-hydration preact react ssr tsx typescript utility vue web-components
Last synced: about 8 hours ago
JSON representation
Create a custom element from any component with these tiny functions (2KB GZipped, ~1KB Brotli). Preact and React currently supported
- Host: GitHub
- URL: https://github.com/jahilldev/component-elements
- Owner: jahilldev
- License: mit
- Created: 2021-02-05T15:15:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T16:12:49.000Z (3 months ago)
- Last Synced: 2025-01-15T17:51:08.952Z (7 days ago)
- Topics: components, custom-elements, hydration, javascript, jsx, library, lightweight, nodejs, partial-hydration, preact, react, ssr, tsx, typescript, utility, vue, web-components
- Language: TypeScript
- Homepage:
- Size: 856 KB
- Stars: 91
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# component-elements
These packages provide the ability to use an HTML custom element as the root for your components. In addition, it allows the use of async code resolution if your custom element isn't immediately used, which is a great strategy for reducing code weight.
# Getting Started
Depending on your component library, visit the relevant package below and follow setup instructions:
| Library | Package |
| ------- | ---------------------------------------------------------------------------------------------------- |
| Preact | [preactement](https://github.com/jahilldev/component-elements/tree/main/packages/preactement#readme) |
| React | [reactement](https://github.com/jahilldev/component-elements/tree/main/packages/reactement#readme) |
| Vue | supported natively! |# Acknowledgement
This function takes _heavy_ inspiration from the excellent [preact-custom-element](https://github.com/preactjs/preact-custom-element). That library served as a starting point for this package, and all of the Preact guys deserve a massive dose of gratitude. I had slightly different needs, so decided to build this as part solution, part learning excersize.