Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 2.3 KB

README.md

File metadata and controls

96 lines (69 loc) · 2.3 KB

component-name

A Web Component for…

Demo | Further reading

Open in StackBlitz

Examples

General usage example:

<script type="module" src="component-name.js"></script>

<component-name>
  <button>Button</button>
</component-name>

Example using a fallback method:

<script type="module" src="component-name.js"></script>

<component-name>
  <button>Button</button>
  <a href="#">Anchor</a>
</component-name>
<style>
  component-name:not(:defined) button,
  component-name:defined a {
    display: none;
  }
</style>

Example using options or additional fallback method:

<script type="module" src="component-name.js"></script>

<component-name attribute="value">
  <button>Button</button>
</component-name>
<style>
  component-name[attribute="value"] {
    outline: 1px solid red;
  }
</style>

Features

This Web Component allows you to:

  • Check for…

Installation

You have a few options (choose one of these):

  1. Install via npm: npm install @daviddarnes/component-name
  2. Download the source manually from GitHub into your project.
  3. Skip this step and use the script directly via a 3rd party CDN (not recommended for production use)

Usage

Make sure you include the <script> in your project (choose one of these):

<!-- Host yourself -->
<script type="module" src="component-name.js"></script>
<!-- 3rd party CDN, not recommended for production use -->
<script
  type="module"
  src="https://www.unpkg.com/@daviddarnes/[email protected]/component-name.js"
></script>
<!-- 3rd party CDN, not recommended for production use -->
<script
  type="module"
  src="https://esm.sh/@daviddarnes/[email protected]"
></script>

Credit

With thanks to the following people: