Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/1000ch/twitter-button

Twitter button as Web Components.
https://github.com/1000ch/twitter-button

twitter web-components

Last synced: 27 days ago
JSON representation

Twitter button as Web Components.

Awesome Lists containing this project

README

        

# twitter-button ![GitHub Actions Status](https://github.com/1000ch/twitter-button/workflows/test/badge.svg)

Twitter button as Web Components.

## Install

Using npm:

```bash
$ npm install twitter-button
```

## Usage

Import and register scripts.

```html

import { TwitterFollowButton } from 'https://unpkg.com/twitter-button/dist/twitter-follow-button.js';
import { TwitterHashtagButton } from 'https://unpkg.com/twitter-button/dist/twitter-hashtag-button.js';
import { TwitterMentionButton } from 'https://unpkg.com/twitter-button/dist/twitter-mention-button.js';
import { TwitterShareButton } from 'https://unpkg.com/twitter-button/dist/twitter-share-button.js';

customElements.define('twitter-follow-button', TwitterFollowButton);
customElements.define('twitter-hashtag-button', TwitterHashtagButton);
customElements.define('twitter-mention-button', TwitterMentionButton);
customElements.define('twitter-share-button', TwitterShareButton);

```

Just put ``, ``, ``, and `` element in your HTML.

```html

```

### `TwitterFollowButton`

- `width`: number, width of `twitter-follow-button`
- `user`: string, Twitter ID to follow
- `size`: string, must be either `s` or `l`, default to `s`

### `TwitterHashtagButton`

- `width`: number, width of `twitter-hashtag-button`
- `text`: string, text to share
- `hashtag`: string, hashtag to attach
- `size`: string, must be either `s` or `l`, default to `s`

### `TwitterMentionButton`

- `width`: number, width of `twitter-mention-button`
- `user`: string, Twitter ID to mention
- `size`: string, must be either `s` or `l`, default to `s`

### `TwitterShareButton`

- `width`: number, width of `twitter-share-button`
- `url`: string, URL to share
- `user`: string, Twitter ID
- `text`: string, text to share
- `size`: string, must be either `s` or `l`, default to `s`

## License

[MIT](https://1000ch.mit-license.org) © [Shogo Sensui](https://github.com/1000ch)