# Storybook





Storybook builds to a static site by default, making it a great fit for Sample.app. Share your component library with your team via a preview URL.

Deploy [#deploy]

<Steps>
  <Step>
    Build Storybook [#build-storybook]

    ```bash
    npx storybook build
    ```

    This outputs to `storybook-static/` by default.
  </Step>

  <Step>
    Deploy to Sample.app [#deploy-to-sampleapp]

    ```bash
    samplex deploy ./storybook-static
    ```
  </Step>
</Steps>

<Callout type="warn">
  `storybook-static/` is not auto-detected by the CLI. You must specify the directory explicitly.
</Callout>

Custom output directory [#custom-output-directory]

You can change the output directory with the `-o` flag:

```bash
npx storybook build -o dist
```

Then auto-detection works:

```bash
samplex deploy
```

Use with a deploy script [#use-with-a-deploy-script]

Add a deploy script to your `package.json` so your team can deploy with one command:

```json title="package.json"
{
  "scripts": {
    "deploy-storybook": "storybook build && samplex deploy ./storybook-static"
  }
}
```
