-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Docs: Update tags, add filtering #32627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update tags guidance
- Add `play-fn` and `test-fn` built-in tags
- Add custom tag definition
- Update sidebar filtering
- Add "exclude test-fn" recipe
- Add main config `tags` API reference
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the 📝 WalkthroughWalkthroughAdds documentation for a new main config property "tags", introduces built-in tags (play-fn, test-fn), JS/TS snippet examples (including excluding test-fn by default), updates writing-stories/tags guidance, and adjusts sidebar ordering metadata for several main-config docs. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant SB as Storybook
participant CFG as ConfigLoader
participant TAG as TagResolver
participant UI as Sidebar
Dev->>SB: start
SB->>CFG: load main.(js|ts)
CFG-->>SB: config { framework, stories, tags }
SB->>TAG: register built-in + custom tags
TAG-->>SB: defaultFilterSelection map
SB->>TAG: assign tags to stories
TAG-->>SB: story-tag mappings
SB->>UI: build sidebar applying include/exclude defaults
UI-->>Dev: render filtered sidebar
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
docs/_assets/writing-stories/custom-tag-filter.pngis excluded by!**/*.pngdocs/_assets/writing-stories/tag-filter.pngis excluded by!**/*.png
📒 Files selected for processing (8)
docs/_snippets/main-config-tags-test-fn-exclude.md(1 hunks)docs/_snippets/main-config-tags.md(1 hunks)docs/api/main-config/main-config-tags.mdx(1 hunks)docs/api/main-config/main-config-typescript.mdx(1 hunks)docs/api/main-config/main-config-vite-final.mdx(1 hunks)docs/api/main-config/main-config-webpack-final.mdx(1 hunks)docs/api/main-config/main-config.mdx(1 hunks)docs/writing-stories/tags.mdx(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-25T09:21:27.284Z
Learnt from: CR
PR: storybookjs/storybook#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-25T09:21:27.284Z
Learning: Applies to test-storybooks/** : Maintain test configurations and assets under test-storybooks/ for Storybook testing
Applied to files:
docs/_snippets/main-config-tags.mddocs/_snippets/main-config-tags-test-fn-exclude.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Danger JS
- GitHub Check: Core Unit Tests, windows-latest
| | Tag | Applied by default? | Description | | ||
| | ---------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `dev` | Yes | Stories tagged with `dev` are rendered in Storybook's sidebar. | | ||
| | `test` | Yes | Stories tagged with `test` are included in [test runner](../writing-tests/integrations/test-runner.mdx#run-tests-for-a-subset-of-stories) or [Vitest addon](../writing-tests/integrations/vitest-addon.mdx#including-excluding-or-skipping-tests) runs. | | ||
| | `autodocs` | No | Stories tagged with `autodocs` are included in the [docs page](../writing-docs/autodocs.mdx). If a CSF file does not contain at least one story tagged with `autodocs`, that component will not generate a docs page. | | ||
| | `play-fn` | No | Applied automatically to stories with a [play function](./play-function.mdx) defined. | | ||
| | `test-fn` | No | Applied automatically to tests defined using the [experimental `.test` method on CSF Factories](https://github.com/storybookjs/storybook/discussions/30119). | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shilman — Reading markdown table diffs sucks, so here's a screenshot:
Do I have the details correct here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would slightly better if Applied by default? => Default and the column values were true or false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we lose some clarity without "applied". I'm going to leave it as-is for now.
|
View your CI Pipeline Execution ↗ for commit fffe5e4
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Everything is correct and reads well AFAICT, though @coderabbitai seems to have caught some issues.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
| Tags can be removed for all stories in your project (in `.storybook/preview.js|ts`), all stories for a component (in the CSF file meta), or a single story (as above). | ||
|
|
||
| ## Filtering by custom tags | ||
| ## Filtering the sidebar by tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this has already been merged, it is worth mentioning that changing this heading will lead to a broken URL in the UI. Specifically in the TagsFilterPanel component
What I did
play-fnandtest-fnbuilt-in tagstagsAPI referenceChecklist for Contributors
Testing
Manual testing
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.Summary by CodeRabbit