Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stencila/components

Package Overview
Dependencies
Maintainers
3
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stencila/components

Stencila Web Components

  • 0.55.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Storybook Built With Stencil

@stencila/components

Stencil

Stencil is a compiler for building fast web apps using Web Components.

Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.

Stencil components are just Web Components, so they work in any major framework or with no framework at all.

Naming Components

Web Component tags may not be CamelCased and they must include a hyphen (-) in the name. Please follow the pattern of <stencila-(component-type)>, for example <stencila-tab-list>.

Using these components

Add to your project

There are two ways to load these components into your project, a script tag in an HTML file, or as a Node module.

Script tag
  • Put the following script tags in the head of your HTML document:
<script type="module" src="https://unpkg.com/@stencila/components@latest/dist/stencila-components/stencila-components.esm.js"></script>
<script type="text/javascript" nomodule="true" src="https://unpkg.com/@stencila/components@latest/dist/stencila-components/stencila-components.js"></script>
  • Then you can use the element anywhere in your HTML, HTML template, JSX, etc.

In modern browsers supporting the module attribute, only the components used on the page will be requested and lazy-loaded, keeping the page size low.

Node module
  • Run npm install @stencila/components --save
  • Import the package in your main/top-level file: import '@stencila/components'
  • Stencil will automatically setup the lazy-loading capabilities for the Stencil library. Then you can use the element anywhere in your template, JSX, HTML etc.

Using and customizing components

The best reference for how to use and combine these components is our component library. The source code for the stories is written using simple lit-html syntax and can be found here.

For general overview of working with WebComponents using plain JavaScript, the StencilJS website provides a good introduction.

Integrating with other web frameworks

Please visit the StencilJS documentation for up to date documentation.

FAQs

Package last updated on 31 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc