Git Product home page Git Product logo

github-buttons's Introduction

github-buttons

Circle CI

To get started, checkout buttons.github.io!

Features

  • Unlimited Button Types
    Our github:button generator provides 6 basic button types including follow, watch, star, fork, issue and download, each at normal or large size, with or without a dynamic count. In addition, almost everything including the API for dynamic count is customizable via simple HTML markup.
  • Pixel Perfect
    Octicons based vector icons always look sharp on every display. The automatically sized iframe solves the big headache of iframe sizing. Plus, its high precision sizing algorithm works the best for HiDPI displays.
  • Fast
    Hosted on GitHub Pages, this service delivers high performance and availability, using asynchronous code that never blocks the page loading.
  • Stable
    High test coverage for the main library and automated tests on Circle CI assure the service quality.
  • Backward Compatible
    As you may still need this, outdated browsers like IE 6 are supported.
  • Accessibility
    ARIA label support enables accessibility for screen reader users.

Documentation

Usage

Add as many <a class="github-button"> as you like, then put the <script> anywhere on your page.

Syntax

<a class="github-button"
   href="{{ link }}"
   data-icon="{{ octicon }}"
   data-count-href="{{ count_link }}"
   data-count-api="{{ count_api }}"
   data-count-aria-label="{{ count_aria_label }}"
   data-style="{{ style }}"
   data-text="{{ button_text }}"
   aria-label="{{ button_aria_label }}"
   >{{ text }}</a>
<script async defer src="https://buttons.github.io/buttons.js"></script>

Attributes

Attribute Description
href GitHub link for the button.
data-icon Octicon for the button. It defaults to octicon-mark-github.
All available icons can be found at Octicons.
data-count-href GitHub link for the count. It defaults to href value.
Relative URL will be relative to href value.
data-count-api GitHub API endpoint and the key path (#hash) for the count.
data-count-aria-label Aria label for the count link.
# in this attribute will be replaced with a real count.
data-style default or mega.
data-text Text displayed on the button. This option will override link_text.
text Text displayed on the button and the fallback link.
aria-label Aira label for the button link.

API Endpoint

You can use any GitHub API endpoint that supports GET request.

You must append a #hash to the endpoint URL to specify a key path for a deep property.

e.g. /repos/octocat/hello-world#owner.login will use owner.login.
e.g. /users/octocat/repos#[0].open_issues_count will use open_issues_count from the first enrty in the array.

See GitHub Developer for API references.

Development

Clone

git clone --recursive https://github.com/ntkme/github-buttons.git
cd github-buttons && npm install

Build

cake build

Test

cake test

See also

License

See LICENSE.md.

github-buttons's People

Contributors

ntkme avatar

Watchers

 avatar  avatar  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.