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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@zeropoll/react-ui

v2.1.0

Published

ZeroPoll React UI

Readme

@zeropoll/react-ui

Ready-to-use React components for integrating ZeroPoll into your application.

Built with:

  • React >=18
  • Tailwind CSS
  • shadcn/ui (for UI components)
  • @zeropoll/react
  • lucide-react (for icons)
  • react-hook-form (for form handling)

Installation

# Install the package
npm install @zeropoll/react-ui
# or
yarn add @zeropoll/react-ui
# or
pnpm add @zeropoll/react-ui
# or
bun add @zeropoll/react-ui

Setup

  1. First, import and include the styles in your app:
import '@zeropoll/react-ui/styles.css';
  1. Wrap your application with the ZeroPollProvider:
import { ZeroPollProvider } from '@zeropoll/react';

function App() {
	return (
		<ZeroPollProvider
			protokitGraphqlUrl="https://chain.zeropoll.xyz/graphql"
			ipfsApiUrl="https://ipfs.zeropoll.xyz"
			tickInterval={1000}
		>
			<YourApp />
		</ZeroPollProvider>
	);
}

Components

PollCard

Display a poll and allow users to vote.

import { PollCard } from '@zeropoll/react-ui';

function MyPoll() {
	return (
		<PollCard
			id="poll-id"
			encryptionKey="optional-encryption-key"
			onLoadSuccess={() => console.log('Poll loaded')}
			onLoadError={message => console.error('Load error:', message)}
			onVoteSuccess={() => console.log('Vote success')}
			onVoteError={message => console.error('Vote error:', message)}
		/>
	);
}

PollCard Props

| Prop | Type | Description | | -------------- | ------------------------- | ------------------------------------------- | | id | string | The poll identifier | | encryptionKey? | string | Optional encryption key for encrypted polls | | className? | string | Additional CSS classes | | onLoadSuccess? | () => void | Called when poll loads successfully | | onLoadError? | (message: string) => void | Called when poll fails to load | | onVoteSuccess? | () => void | Called when vote is successful | | onVoteError? | (message: string) => void | Called when vote fails |

PollFormCard

Component for creating new polls.

import { PollFormCard } from '@zeropoll/react-ui';

function CreatePoll() {
	return (
		<PollFormCard
			onSuccess={result => {
				console.log('Poll created:', result.id);
			}}
			onError={message => {
				console.error('Error:', message);
			}}
		/>
	);
}

PollFormCard Props

| Prop | Type | Description | | ---------- | --------------------------------------------------------------------- | ------------------------------- | | className? | string | Additional CSS classes | | onSuccess? | (result: { id: string; hash: string; encryptionKey: string }) => void | Called when poll is created | | onError? | (message: string) => void | Called when poll creation fails |

Features

PollCard

  • Display poll title, description, and options
  • Real-time vote counting and percentages
  • Wallet connection integration
  • Vote casting functionality
  • Eligible voters list
  • Share functionality
  • Loading and error states
  • Responsive design

PollFormCard

  • Two-step form process
  • Title and description inputs
  • Dynamic option management (add/remove)
  • Voter wallet address management
  • Form validation
  • Loading states
  • Error handling

Styling

The components use Tailwind CSS and shadcn/ui. You can customize the appearance by:

  1. Modifying the Tailwind configuration
  2. Using the className prop
  3. Overriding the base styles in your CSS

License

This package is part of the ZeroPoll monorepo and is licensed under the MIT License. See the root LICENSE file for details.