project.json:

1//... 2"ui": { 3 "targets": { 4 //... 5 "storybook": { 6 "executor": "@nx/storybook:storybook", 7 "options": { 8 "port": 4400, 9 "configDir": "libs/ui/.storybook" 10 }, 11 "configurations": { 12 "ci": { 13 "quiet": true 14 } 15 } 16 }, 17 } 18} 19
1nx run ui:storybook 2

Examples

For non-Angular projects

You can work in docs mode, building a documentation-only site, by setting the docsMode option to true and using the @storybook/addon-docs addon.

Read more on the Storybook documentation page for addon-docs.

1"storybook": { 2 "executor": "@nx/storybook:storybook", 3 "options": { 4 "port": 4400, 5 "configDir": "libs/ui/.storybook", 6 "docsMode": true 7 }, 8 "configurations": { 9 "ci": { 10 "quiet": true 11 } 12 } 13} 14

For Angular projects

This is the default configuration for Angular projects using Storybook. You can see that it uses the native @storybook/angular:start-storybook executor. You can read more about the configuration options at the relevant Storybook documentation page.

1"storybook": { 2 "executor": "@storybook/angular:start-storybook", 3 "options": { 4 "port": 4400, 5 "configDir": "libs/ui/.storybook", 6 "browserTarget": "ui:build", 7 "compodoc": false 8 }, 9 "configurations": { 10 "ci": { 11 "quiet": true 12 } 13 } 14}, 15

Options

configDir

Required
string

Directory where to load Storybook configurations from.

ci

boolean
Default: false

CI mode (skip interactive prompts, don't open browser).

docs

boolean

Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.

docsMode

boolean
Default: false

Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.

debugWebpack

boolean

Display final webpack configurations for debugging purposes.

disableTelemetry

boolean

Disables Storybook's telemetry.

host

string

Host to listen on.

https

boolean
Default: false

Serve Storybook over HTTPS. Note: You must provide your own certificate information.

loglevel

string
Pattern: (silly|verbose|info|warn|silent)

Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].

noOpen

boolean

Do not open Storybook automatically in the browser.

open

boolean

Open browser window automatically.

port

number
Default: 9009

Port to listen on.

previewUrl

string

Preview URL.

quiet

boolean

Suppress verbose build output.

sslCa

string

Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate).

sslCert

string

Provide an SSL certificate. (Required with --https).

sslKey

string

Provide an SSL key. (Required with --https).

smokeTest

boolean

Exit after successful start.

webpackStatsJson

boolean โˆช string
Default: false

Write Webpack Stats JSON to disk.

Additional Properties

anything

Extra properties of any type may be provided to this object.

staticDir

Deprecated
Array<string>

Directory where to load static files from, array of strings.

In Storybook 6.4 the --static-dir CLI flag has been replaced with the the staticDirs field in .storybook/main.js. It will be removed completely in Storybook 7.0.

uiFramework

Deprecated
string
Accepted values: @storybook/react, @storybook/html, @storybook/web-components, @storybook/vue, @storybook/vue3, @storybook/svelte

Storybook framework npm package.

Upgrade to Storybook 7.