Giter VIP home page Giter VIP logo

wc-dot-hr's Introduction

wc-dot-hr

published coverage npm npm jsDelivr GitHub issues license

NPM

Dotted style horizontal rule web component.

Installation

You can install wc-dot-hr with npm, or just get started quickly with CDN.

Install from npm

To install from npm, open terminal in your project folder and run:

npm install wc-dot-hr

After the package is installed, then you can import the bubble web component into you code:

import 'wc-dot-hr';

window.onload = function() {
  let dotHr = document.createElement('dot-hr');
  // specify dot number with css variable
  dotHr.style.setProperty('--hr-dots-number', 5)
  document.body.appendChild(starInput);
}

Install from CDN

There is jsDelivr CDN available for quickly integrated with your web page.

<!-- Latest version -->
<script src="https://cdn.jsdelivr.net/npm/wc-dot-hr"></script>

<!-- Specific version -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

Basic Usages:

<html>
  <head>

    <!-- Load wc-dot-hr WebComponent library -->
    <script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
    <!-- End Load -->

  </head>

  <body>

    <!-- Using "dot-hr" html tag to generate horizontal rule -->
    <p>blablabla...</p>
    <dot-hr></dot-hr>
    <p>blablabla...</p>
</form>

  </body>
</html>

Demo page

Demo: https://yishiashia.github.io/wc-dot-hr/

Usage

If you want to customize this web component, you can import the library and implement your new class by extend DotHr.

import DotHr from "wc-dot-hr";

class customizedDotHr extends DotHr {
    // override here
}

Customized style

To customize the dotted hr style, you can use the css variables.

CSS variable Description
--hr-dots-number The number of dots, default value is 3
--hr-light-color The color of dot when the prefers-color-scheme is light. The default value is #666
--hr-dark-color The color of dot when the prefers-color-scheme is dark. The default value is #ccc
--hr-dot-size The size of dot. The default value is 8px
--hr-space-between The space between dots. The default value is 24px

wc-dot-hr's People

Contributors

yishiashia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.