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

@core-design/components

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@core-design/components

Core Design System Components

  • 2.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
3
Weekly downloads
 
Created
Source

Core Components

Package Management

This repo leverages Lerna, a tool for managing multiple packages within the same repo.

Lerna takes the place of typical npm and yarn commands. For a full breakdown of lerna commands, see the lerna readme

Getting Started

To start developing your Stencil project, run:

From root:

lerna run start

To start developing your Stencil project in Storybook, run:

From root:

lerna run storybook

Component Structure

Stencil components are plain ES6/TypeScript classes with some decorator metadata.

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

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

@Component({
  tag: "core-component",
  styleUrl: "core-component.css",
})
export class Component {
  @Prop() first: string;
  @Prop() last: string;

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

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

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

Naming Components

When creating new component tags, use the core- prefix and kebab-case.

For example: core-button, core-icon, etc. Custom Elements must contain a dashed name so they do not collide with existing html element names.

API

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

Components

DecoratorDescription
@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.

High Level Component Example

View high level component example here

Browser Support

Web Components, specifically Custom Elements, are natively supported in Chrome and Safari and are coming to both Edge and Firefox. A dynamic polyfill loader is already included in order to only load the polyfills for the browsers that are missing specific features.

  • Chrome (and all Chromium based browsers)
  • Safari
  • Edge
  • Firefox
  • IE 11

Polyfills

Stencil includes a subset of the core-js polyfills for old browsers like IE11, fetch and conditionally downloads the Custom Elements v1 only when it's needed for modern browsers (EDGE and old versions of Firefox.)

Internet Explorer 11

View IE11 polyfill details here

In addition, the following set of polyfills are also included:

All browsers

Some modern browsers like Edge do not include native support for Web Components. In that case, we conditionally load the Custom Elements v1 polyfill.


Built With Stencil

FAQs

Package last updated on 10 Jun 2020

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