3.2.0 • Published 3 years ago
announcekit-react v3.2.0

The easiest way to use AnnounceKit widgets in your React App.
Visit https://announcekit.app to get started with AnnounceKit.
Installation
yarn add announcekit-reactUsage
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 selectoruser- User properties (for user tracking)data- Segmentation datalabels- In case you want to filter and display posts under a specific label or tag.user_token- JWT setup: https://announcekit.app/docs/jwtonWidgetOpen- 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>
)
}3.2.0
3 years ago
3.1.1
4 years ago
3.1.0
4 years ago
2.1.8
4 years ago
2.1.7
4 years ago
3.0.1
4 years ago
3.0.0
4 years ago
2.1.6
4 years ago
2.1.5
5 years ago
2.1.4
5 years ago
2.1.3
5 years ago
2.1.2
5 years ago
2.1.1
5 years ago
2.1.0
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.2.5
6 years ago
1.2.4
6 years ago
1.2.3
6 years ago
1.2.2
6 years ago
1.2.1
6 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago