- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 9.8k
 
Open
Labels
Description
Describe the bug
The !autodocs tag still displays the story as a preview of the component if it is the first story in the file. If the story is moved after the first one, it is completely hidden as expected.
Expected behavior: The !autodocs tag should hide the story completely from the documentation, regardless of its location within the file.
Reproduction link
https://68e7c3607e6dc5d3051d143e-zfywlhkgqk.chromatic.com/?path=/docs/example-button--docs
Reproduction steps
- Add 
tag: [!autodocs]to the first story in the code. - In the component documentation, the preview of the component is the story to which we just added 
!autodocs. 
System
➜  storybook-docs-issue git:(main) ✗ npx storybook@latest info
Storybook Environment Info:
  System:
    OS: macOS 26.0
    CPU: (8) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.20.0 - ~/.nvm/versions/node/v22.20.0/bin/node
    npm: 10.9.3 - ~/.nvm/versions/node/v22.20.0/bin/npm <----- active
    pnpm: 10.17.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 141.0.7390.56
    Safari: 26.0
  npmPackages:
    @storybook/addon-docs: ^9.1.10 => 9.1.10
    @storybook/preset-create-react-app: ^9.1.10 => 9.1.10
    @storybook/react-webpack5: ^9.1.10 => 9.1.10
    eslint-plugin-storybook: ^9.1.10 => 9.1.10
    storybook: ^9.1.10 => 9.1.10Additional context
The story will be hidden under "STORIES" in the docs, but it is still shown as a preview if it's the first story in the file.
dosubot