npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-kofi

v0.0.2

Published

Ko-fi buttons, modals, and react components built with Radix for React.js projects (unofficial)

Downloads

108

Readme

React Ko-Fi ☕

React Ko-Fi is a collection of React components that displays various Ko-Fi widgets in React:

  1. KoFiDialog: A Ko-Fi button that opens dialog displaying the Ko-Fi widget.
  2. KoFiButton: A button that opens a Ko-Fi website in a new tab.
  3. KoFiWidget: The Ko-Fi floating widget as a React component.
  4. KoFiPanel: The Ko-Fi panel widget as a React component.

These components are made by Prototypr and make it easier to display and customise Ko-Fi widgets in your React project. There's also an additional dialog component that opens a Ko-Fi widget in a modal.

npm install react-kofi

To use it in your project, import the components you need, along with the css:

import { KoFiDialog, KoFiButton, KoFiWidget, KoFiPanel } from "react-kofi";
import "react-kofi/dist/styles.css";

Support us on Ko-Fi

If you find this package useful, you can support us on Ko-Fi too (or just star the repo):

ko-fi


KofiDialog

The KofiDialog component displays a Ko-Fi button that opens a dialog containing the Ko-Fi donation panel. It's a modal that opens when the user clicks the button.

Created with a Radix Dialog, this component essentially embeds the Ko-Fi Panel inside a dialog, so you can present the panel on click:

KoFi Dialog

<KoFiDialog
  color="#00b4f7"
  textColor="#fff"
  id="prototypr"
  label="Support me"
  padding={0}
  width={400}
  iframe={false}
  buttonRadius="8px"
/>

| Prop | Description | Default Value | | ------------ | -------------------------------------------------------------------------------------------------- | ------------- | | color | Background color of the Ko-Fi button | "#00b4f7" | | textColor | Text color of the Ko-Fi button | "#fff" | | id | Your Ko-Fi ID (see your profile url) | "prototypr" | | label | Text displayed on the Ko-Fi button | "Support me" | | padding | Padding around the dialog content | 0 | | width | Width of the dialog | 400 | | iframe | Not needed if you supply the id prop. Here you can paste in the iframe code from the Ko-Fi website | false | | buttonRadius | Border radius of the Ko-Fi button | "8px" |


KoFiButton

Just a button that opens a Ko-Fi website in a new tab. The button is styled with a bit of tailwindcss and a separate kofi css sheet.

KoFi Button

<KoFiButton
  color="#00b4f7"
  id="prototypr"
  label="Support me on Ko-Fi"
  radius="12px"
/>

| Prop | Description | Default Value | | ------ | ------------------------------------ | --------------------- | | color | Background color of the Ko-Fi button | "#00b4f7" | | id | Your Ko-Fi ID (see your profile url) | "prototypr" | | label | Text displayed on the Ko-Fi button | "Support me on Ko-Fi" | | radius | Border radius of the Ko-Fi button | "12px" |


KoFiWidget

The KoFiWidget component displays a Ko-Fi floating widget as a React component. The Ko-Fi button is attached to the bottom left of the page, and you can click it to open the donation panel.

KoFi Widget

<KoFiWidget
  attachOnScroll={false}
  id="prototypr"
  label="Support me"
  color="#00b9fe"
  textColor="#fff"
/>

| Prop | Description | Default Value | | -------------- | -------------------------------------- | ------------- | | attachOnScroll | Whether to attach the widget on scroll | false | | id | Your Ko-Fi ID (see your profile url) | "prototypr" | | label | Text displayed on the Ko-Fi widget | "Support me" | | color | Background color of the Ko-Fi widget | "#00b9fe" | | textColor | Text color of the Ko-Fi widget | "#fff" |

Note: if you use attachOnScroll, the Ko-Fi widget script loads and attaches only when you scroll down the page. This is useful if you don't want to load the widget straight away which can be better for page load performance.


KoFiPanel

The KoFiPanel component displays the full Ko-Fi donation panel as a React component.

KoFi Panel

<KoFiPanel id="prototypr" />

Optional for tailwind projects

The general styles (e.g. the modal, padding, etc.) are implemented with tailwindcss, and then a separate kofi.css stylesheet is used to style the Ko-Fi widget.

If your project already uses tailwindcss, you can add this to your tailwind config:

module.exports = {
content: ["./node_modules/react-kofi/dist/**/*.{js,ts,jsx,tsx}",],

and then only import the kofi stylesheet separately to avoid conflicts:

import "react-kofi/dist/kofi.css";