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

storybook-addon-next-auth

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-addon-next-auth

Use NextAuth.js in your Storybook stories

  • 0.0.4
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

NextAuth.js Storybook Addon

Use NextAuth.js in your Storybook stories.


Getting Started

Install this library by adding it to your devDependencies:

yarn:

yarn install --dev storybook-addon-next-auth

npm:

npm install --save-dev storybook-addon-next-auth

pnpm:

pnpm add --save-dev storybook-addon-next-auth

Storybook

Add to your storybook preview

Update .storybook/main.js and append to your list of addons:

// .storybook/main.js
module.exports = {
  addons: ['storybook-addon-next-auth']
}

Use toolbar menu

After restarting your storybook, an additional icon will appear in the toolbar. It allows you to select the current session state:

ToolBar menu example

You may now control and test your component state of useSession() by the toolbar items:

Session control example


Access current session data in stories

If you need to change your stories code while using session values, you may access those by the useSession hook.

import { useSession } from 'next-auth/react';

export const MyStory = (props) => {
  // get access to current session data
  const session = useSession();

  ...

Customize session auth states

This component brings a default set of auth states: unknown, loading, unauthenticated and authenticated.

⏱ Coming Soon

Contributing

⏱ Coming Soon

Author & Credits

Author: Emilio Schaedler Heinzmann

Special thanks for Tom Freudenberg, the creator of next-auth-mock, where I've based my work for this library.

Keywords

FAQs

Package last updated on 27 Dec 2022

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