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

blockstack-signin-btn

v1.0.3

Published

A React component to load a Sign in with Blockstack button

Readme

Sign In with Blockstack Button (React Component)

Image of Sign in with Blockstack react component

Installing

npm install blockstack-signin-btn --save

Use

There are two components in this library: SignInBlockstackButton and SignInBlockstackLiteButton. SignInBlockstackButton has the blockstack sign in and sign out functions written. These functions are passed into SignInBlockstackLiteButton as props. SignInBlockstackButton uses SignInBlockstackLiteButton. Reference the code for more.

Importing

At the top of the file, include:

import { SignInBlockstackButton, SignInBlockstackLiteButton } from 'blockstack-signin-btn';

Minimum

This is the bare minimum. You should reference the blockstack.js library to check if the user is logged in with blockstack.isUserSignedIn() and pass that to isSignedIn.

<SignInBlockstackButton />

Customize Button Text

You can change the button text from the default of Sign In with Blockstack and Sign Out. You pass in your wanted text as props:

<SignInBlockstackButton
  signInBtnText="New Sign In Text"
  signOutBtnText="New Sign Out Text"
/>

Hide the Blockstack Logo in Button

We include the Blockstack logo on the left side of the button. You can hide this, just pass in the prop includeBlockstackLogo as false.

<SignInBlockstackButton
  includeBlockstackLogo={false}
/>

Custom Redirect on Sign Out

This is just for SignInBlockstackButton and not the lite. Since the sign out function is already written, by default it redirects after sign out to /. This can be changed with signOutRedirect.

<SignInBlockstackButton
  signOutRedirect="/custom-signout-page"
/>

Render Nothing

This was included in case the developer want to not render a sign in or sign out button. The user may be pending sign in, etc.

<SignInBlockstackButton
  renderNothing
/>

// or

<SignInBlockstackButton
  renderNothing={true}
/>

Custom Styling

All styling has been done inline to control the areas to manipulate and name issues. All aspects of the button can be customized in terms of styling. The text can be styled with textStyle prop. The image/logo can be styled with imageStyle prop. The sign out button can be styled with signOutStyle prop. The sign in button can be styled with signInStyle prop. Both buttons can be styled with style prop. You can remove default styling with defaultStyle prop.

<SignInBlockstackButton
  textStyle={{
    fontSize: 24,
  }}
  imageStyle={{
    height: 100,
  }}
  signOutStyle={{
    backgroundColor: 'red',
  }}
  signInStyle={{
    backgroundColor: 'green',
  }}
/>

// or for both buttons at once and remove default

<SignInBlockstackButton
  textStyle={{
    color: '#2e2e2e',
  }}
  style={{
    backgroundColor: '#fff',
  }}
  defaultStyle={{}}
/>

Testing

To test this component, we will use a link to a pre built demo project. In a terminal window:

git clone https://github.com/alanbsmith/component-lib-playground.git
cd component-lib-playground/
npm install

In another terminal:

git clone https://github.com/keithweaver/Sign-in-with-Blockstack-react.git
cd Sign-in-with-Blockstack-react
npm install
npm link

Returning to the first terminal window, you should then run:

npm link blockstack-signin-btn
npm run dev

An app will be running on http://localhost:8080 and you will be able to add blockstack-signin-btn to it. If you open src/components/App.js and add import { SignInBlockstackButton } from 'blockstack-signin-btn'; to the top. Then add code below to the render. It will add the button. This request will however fail because you need the manifest.json and other Blockstack parts.

<SignInBlockstackButton />

Reference