1 | <p align="center">
|
2 | <a href="#">
|
3 | <img alt="stencil-logo" src="https://github.com/ionic-team/stencil/blob/main/stencil-logo.png" width="60">
|
4 | </a>
|
5 | </p>
|
6 |
|
7 | <h1 align="center">
|
8 | Stencil
|
9 | </h1>
|
10 |
|
11 | <p align="center">
|
12 | A compiler for generating <a href="https://www.webcomponents.org/introduction" target="_blank" rel="noopener noref">Web Components</a> using technologies like TypeScript and JSX, built by the <a href="https://ionic.io/">Ionic team</a>.
|
13 | </p>
|
14 |
|
15 | <p align="center">
|
16 | <a href="https://www.npmjs.com/package/@stencil/core">
|
17 | <img src="https://img.shields.io/npm/v/@stencil/core.svg" alt="StencilJS is released under the MIT license." /></a>
|
18 | <a href="https://github.com/ionic-team/stencil/blob/main/LICENSE.md">
|
19 | <img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="StencilJS is released under the MIT license." />
|
20 | </a>
|
21 | <a href="https://github.com/ionic-team/stencil/blob/main/CONTRIBUTING.md">
|
22 | <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
23 | </a>
|
24 | <a href="https://twitter.com/stenciljs">
|
25 | <img src="https://img.shields.io/badge/follow-%40stenciljs-1DA1F2?logo=twitter" alt="Follow @stenciljs">
|
26 | </a>
|
27 | <a href="https://chat.stenciljs.com">
|
28 | <img src="https://img.shields.io/discord/520266681499779082?color=7289DA&label=%23stencil&logo=discord&logoColor=white" alt="Official Ionic Discord" />
|
29 | </a>
|
30 | </p>
|
31 |
|
32 | <h2 align="center">
|
33 | <a href="https://stenciljs.com/docs/getting-started#starting-a-new-project">Quick Start</a>
|
34 | <span> · </span>
|
35 | <a href="https://stenciljs.com/docs/introduction">Documentation</a>
|
36 | <span> · </span>
|
37 | <a href="https://github.com/ionic-team/stencil/blob/main/CONTRIBUTING.md">Contribute</a>
|
38 | <span> · </span>
|
39 | <a href="https://ionicframework.com/blog/tag/stencil/">Blog</a>
|
40 | <br />
|
41 | Community:
|
42 | <a href="https://chat.stenciljs.com">Discord</a>
|
43 | <span> · </span>
|
44 | <a href="https://forum.ionicframework.com/c/stencil/21/">Forums</a>
|
45 | <span> · </span>
|
46 | <a href="https://twitter.com/stenciljs">Twitter</a>
|
47 | </h2>
|
48 |
|
49 | ### Getting Started
|
50 |
|
51 | Start a new project by following our quick [Getting Started guide](https://stenciljs.com/docs/getting-started).
|
52 | We would love to hear from you!
|
53 | If you have any feedback or run into issues using Stencil, please file an [issue](https://github.com/ionic-team/stencil/issues/new) on this repository.
|
54 |
|
55 | ### Examples
|
56 | A Stencil component looks a lot like a class-based React component, with the addition of TypeScript decorators:
|
57 | ```tsx
|
58 | import { Component, Prop, h } from '@stencil/core';
|
59 |
|
60 | @Component({
|
61 | tag: 'my-component', // the name of the component's custom HTML tag
|
62 | styleUrl: 'my-component.css', // css styles to apply to the component
|
63 | shadow: true, // this component uses the ShadowDOM
|
64 | })
|
65 | export class MyComponent {
|
66 | // The component accepts two arguments:
|
67 | @Prop() first: string;
|
68 | @Prop() last: string;
|
69 |
|
70 | //The following HTML is rendered when our component is used
|
71 | render() {
|
72 | return (
|
73 | <div>
|
74 | Hello, my name is {this.first} {this.last}
|
75 | </div>
|
76 | );
|
77 | }
|
78 | }
|
79 | ```
|
80 |
|
81 | The component above can be used like any other HTML element:
|
82 |
|
83 | ```html
|
84 | <my-component first="Stencil" last="JS"></my-component>
|
85 | ```
|
86 |
|
87 | Since Stencil generates web components, they work in any major framework or with no framework at all.
|
88 | In many cases, Stencil can be used as a drop in replacement for traditional frontend framework, though using it as such is certainly not required.
|
89 |
|
90 | ### Contributing
|
91 |
|
92 | Thanks for your interest in contributing!
|
93 | Please take a moment to read up on our guidelines for [contributing](https://github.com/ionic-team/stencil/blob/main/CONTRIBUTING.md).
|
94 | Please note that this project is released with a [Contributor Code of Conduct](https://github.com/ionic-team/stencil/blob/main/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. |
\ | No newline at end of file |