All Projects → ionic-team → Stencil

ionic-team / Stencil

Licence: other
A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
SCSS
7915 projects
stylus
462 projects

Projects that are alternatives of or similar to Stencil

Ionic Framework
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Stars: ✭ 45,802 (+363.58%)
Mutual labels:  ionic, webcomponents, stencil, pwa, stenciljs
Deckdeckgo
The web open source editor for presentations
Stars: ✭ 1,117 (-88.69%)
Mutual labels:  ionic, webcomponents, stencil, pwa, progressive-web-app
anywhere-webcomponents
A UI work in progress based on custom elements (web components) for use in anywhere.
Stars: ✭ 17 (-99.83%)
Mutual labels:  webcomponents, stencil, custom-elements, stenciljs
web-photo-filter
A Web Component to apply Instagram-like WebGL filters to photos
Stars: ✭ 105 (-98.94%)
Mutual labels:  webcomponents, stencil, stenciljs
block-photos
A photos app built with Ionic and Blockstack as backend.
Stars: ✭ 24 (-99.76%)
Mutual labels:  ionic, stencil, stenciljs
stencil-boilerplate
A Stencil app boilerplate including routing, Redux etc.
Stars: ✭ 51 (-99.48%)
Mutual labels:  progressive-web-app, stencil, stenciljs
domy
Custom Elements Storage
Stars: ✭ 77 (-99.22%)
Mutual labels:  webcomponents, stencil, custom-elements
app-starter
Angular mono-repo (Ionic/Capacitor/StencilJS/Web Component) app starter for supporting cross platform apps.
Stars: ✭ 75 (-99.24%)
Mutual labels:  ionic, webcomponents, stenciljs
vite-plugin-sloth
Fresh take on static site generation, using HTML-first approach to build website. Powered by ⚡️ Vite
Stars: ✭ 39 (-99.61%)
Mutual labels:  webcomponents, custom-elements, ssg
onchat-web
A simple, beautiful, mobile-first instant messaging progressive web application.
Stars: ✭ 138 (-98.6%)
Mutual labels:  ionic, pwa, progressive-web-app
ionic-custom-components
🌈 Ionic Tutorial: Mastering Web Components in Ionic Framework. This repo is an Ionic project showcasing Angular custom components and Stencil custom web components.
Stars: ✭ 30 (-99.7%)
Mutual labels:  ionic, stencil, stenciljs
pdf-viewer
PDF viewer web component built in StencilJS. Reusable in Angular, Ionic, React, Vue.JS, etc.
Stars: ✭ 65 (-99.34%)
Mutual labels:  ionic, stencil, stenciljs
gatsby-remark-highlight-code
Adds stylish cards and syntax highlighting to code blocks in markdown files
Stars: ✭ 63 (-99.36%)
Mutual labels:  webcomponents, stencil, stenciljs
capacitor-site
Capacitor website
Stars: ✭ 0 (-100%)
Mutual labels:  ionic, stencil, stenciljs
Ionicons
Premium hand-crafted icons built by Ionic, for Ionic apps and web apps everywhere 🌎
Stars: ✭ 15,802 (+59.94%)
Mutual labels:  ionic, webcomponents, stenciljs
solar-components
Web Components Implementation of Solar Design System
Stars: ✭ 16 (-99.84%)
Mutual labels:  webcomponents, stencil, stenciljs
Atoms
Atoms for Blaze UI
Stars: ✭ 1,505 (-84.77%)
Mutual labels:  webcomponents, stencil, stenciljs
Ionic Stencil Hn App
Ionic Stencil HackerNews App
Stars: ✭ 105 (-98.94%)
Mutual labels:  ionic, pwa, progressive-web-app
greenwood
Greenwood is your workbench for the web, focused on supporting modern web standards and development to help you create your next project.
Stars: ✭ 48 (-99.51%)
Mutual labels:  webcomponents, ssr, ssg
Ionic Pwa
🚀 Build a Progressive Web App with Ionic and Angular. Push Notifications. Deployed to Firebase Hosting. The Complete guide to build your PWA. Service Workers. Lighthouse. Web Manifest
Stars: ✭ 87 (-99.12%)
Mutual labels:  ionic, pwa, progressive-web-app

npm Build & Test license

Stencil: A Compiler for Web Components and PWAs

npm init stencil

Stencil is a simple compiler for generating Web Components and static site generated progressive web apps (PWA). Stencil was built by the Ionic team for its next generation of performant mobile and desktop Web Components.

Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. It takes TypeScript, JSX, an asynchronous rendering pipeline to ensure smooth running animations, lazy-loading out of the box, and generates 100% standards-based Web Components that run on both modern browsers and legacy browsers.

Stencil components are just Web Components, so they work in any major framework or with no framework at all. In many cases, Stencil can be used as a drop in replacement for traditional frontend frameworks given the capabilities now available in the browser, though using it as such is certainly not required.

Stencil also enables a number of key capabilities on top of Web Components, in particular Server Side Rendering (SSR) without the need to run a headless browser, pre-rendering, and objects-as-properties (instead of just strings).

Note: Stencil and Ionic Framework are completely independent projects. Stencil does not prescribe any specific UI framework, but Ionic Framework is the largest user of Stencil (today!)

Why Stencil?

Stencil is a new approach to a popular idea: building fast and feature-rich apps in the browser. Stencil was created to take advantage of major new capabilities available natively in the browser, such as Custom Elements v1, enabling developers to ship far less code and build faster apps that are compatible with any and all frameworks.

Stencil is also a solution to organizations and library authors struggling to build reusable components across a diverse spectrum of frontend frameworks, each with their own component system. Stencil components work in React, Vue, Angular and Ember, as well as they work with jQuery or with no framework at all, because they are just plain HTML elements.

Compared to using Custom Elements directly, inside of every Stencil component is an efficient JSX rendering system, asynchronous rendering pipeline to prevent jank, and more. This makes Stencil components more performant while maintaining full compatibility with plain Custom Elements. Think of Stencil as creating pre-baked Custom Elements as if you wrote in those features yourself.

Getting Started

To create a new project using an interactive cli, run:

npm init stencil

To start developing your new Stencil project, run:

npm start

Creating components

Stencil components are TypeScript classes with decorator metadata. The decorators themselves are purely build-time annotations so the compiler can read metadata about each component, and removed entirely for smaller efficient components.

Create new components by creating files with a .tsx extension, such as my-component.tsx, and place them in src/components.

import { Component, Prop, h } from '@stencil/core';

@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css'
})
export class MyComponent {

  @Prop() first: string;

  @Prop() last: string;

  render() {
    return (
      <div>
        Hello, my name is {this.first} {this.last}
      </div>
    );
  }
}

Note: the .tsx extension is required, as this is the standard for TypeScript classes that use JSX.

To use this component, just use it like any other HTML element:

<my-component first="Stencil" last="JS"></my-component>

API

The API for stencil closely mirrors the API for Custom Elements v1.

Components

Decorator Description
@Component() Indicate a class is a Stencil component.
@Prop() Creates a property that will exist on the element and be data-bound to this component.
@State() Creates a local state variable that will not be placed on the element.
@Method() Expose specific methods to be publicly accessible.

Why "Stencil?"

A Stencil is a tool artists use for drawing perfect shapes easily. We want Stencil to be a similar tool for web developers: a tool that helps web developers build powerful Web Components and apps that use them, but without creating non-standard runtime requirements.

Stencil is a tool developers use to create Web Components with some powerful features baked in, but it gets out of the way at runtime.

Related

Testing powered by


BrowserStack Open-Source Program

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].