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

announcekit-react

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

announcekit-react

Use AnnounceKit widgets in your React App

  • 3.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
decreased by-23.63%
Maintainers
1
Weekly downloads
 
Created
Source

The easiest way to use AnnounceKit widgets in your React App.

Visit https://announcekit.app to get started with AnnounceKit.

CodeSandBox Demo

Documentation

Installation

yarn add announcekit-react

Usage

import React from "react";
import AnnounceKit from "announcekit-react";

class App extends React.Component {
  render() {
    return (
      <div>
        <nav>
          <ul>
            <li>
              <a href="#">Home</a>
            </li>
            <li>
              <AnnounceKit widget="https://announcekit.co/widgets/v2/3xdhio">
                <span>Whats new</span>
              </AnnounceKit>
            </li>
          </ul>
        </nav>
      </div>
    );
  }
}

Props

  • widget - The url of the widget. You can obtain it while creating or editing widget in AnnounceKit Dashboard.
  • widgetStyle - You can apply CSS rules to modify / tune the position of the widget launcher.
  • floatWidget - Set true if the widget is a Float widget.
  • embedWidget - Set true if the widget is a Embed widget.
  • boosters - In case you don't want to boosters appear on the page the widget is placed.
  • lang - Language selector
  • user - User properties (for user tracking)
  • data - Segmentation data
  • labels - In case you want to filter and display posts under a specific label or tag.
  • user_token - JWT setup: https://announcekit.app/docs/jwt
  • onWidgetOpen - Called when the widget is opened.
  • onWidgetClose - Called when the widget is closed.
  • onWidgetResize - Called when the widget is resized.
  • onWidgetUnread - Called when unread post count of widget has been updated.

API

You can use ref property to access the widget instance and call control functions

  • open()
  • close()
  • unread()
  • instance()
function App() {
  const ref = React.createRef<AnnounceKit>();

  React.useEffect(() => {
    ref.current.unread().then(an => console.log("unread", an));
  });

  return (
    <div>
        <button onClick={async() => await ref.current.open()}>
            Click to open widget
        </button>
        <AnnounceKit ref={ref} widget="https://announcekit.co/widgets/v2/3xdhio">
            <span>Whats new</span>
        </AnnounceKit>
    </div>
    )
}

Keywords

FAQs

Package last updated on 18 Jan 2023

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