Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Render component README in every Storybook docs page - #4908

Merged
GC Zhu (gc-skyscanner) merged 15 commits into
mainfrom
gert-janvercauteren/readme-in-storybook-v1
Jul 17, 2026
Merged

GC Zhu (gc-skyscanner) merged 15 commits into
mainfrom
gert-janvercauteren/readme-in-storybook-v1

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

What

Adds parameters.docs.page to all 112 component story files (.tsx and .js) so that each component's README.md is rendered inline in the Storybook Docs tab.

Removes the duplicate <Title /> block — the README already contains the component heading, so rendering both was redundant.

How

Each story now imports its README.md and renders it via <Markdown>{readme}</Markdown> between the page title and the arg types table:

parameters: {
  docs: {
    page: () => (
      <>
        <Markdown>{readme}</Markdown>
        <ArgTypes exclude={['zoomEnabled']} />
      </>
    ),
  },
},

Nested V2/V3 components (e.g. BpkModalV2, BpkCheckboxV2, BpkComparisonTable) use their own local README.md where one exists, falling back to the top-level component README otherwise.

Test plan

  • Open Storybook and navigate to any component's Docs tab — the README content should now appear above the arg types table
  • Confirm no duplicate title (the README heading replaces the old <Title />)

Add a webpack rule to import Markdown files as raw source strings, plus
a TypeScript module declaration for `*.md`. Wire BpkBadge's Docs page to
render its README beneath the title via the <Markdown> block.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add a storybook-import step to the SupernovaPublish job so the built
Storybook is pushed to Supernova on release. Checkout, setup-node and a
Storybook build-cache restore are added since the job now needs the
dist-storybook files locally.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…k rule initialisation

- Add <Title /> before <Markdown> in BpkBadge docs.page so the Docs
  page renders Title → README → props table as described in the PR
- Initialise webpackConfig.module and .rules explicitly before pushing
  the .md rule, removing the silent no-op risk from optional chaining

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Avoid mutating the webpackConfig parameter directly; build the updated
config immutably and return it instead.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…step

Fixes zizmor cache poisoning warning — SupernovaPublish never runs pnpm
install so caching the pnpm store is unnecessary and a security risk.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Adds `parameters.docs.page` to all component story files (.tsx and .js)
so that each component's README.md is rendered in the Storybook docs tab
via `<Markdown>{readme}</Markdown>`. The duplicate `<Title />` block is
removed since the README already contains the component heading.

Covers all 112 story files across the monorepo, including nested V2/V3
components which use their own local README where one exists.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 17, 2026 08:36
Keep both parameters.docs.page and tags: ['dark-mode-compatible'] in
BpkButton, BpkCard, and BpkCardV2 story metas.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Comment thread .github/workflows/release.yml Fixed
with:
persist-credentials: false

- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

skyscanner-backpack-bot Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor
Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against fcd0b0c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds per-component README rendering inside every Storybook Docs tab by wiring parameters.docs.page across component stories and enabling raw .md imports in the Storybook webpack config.

Changes:

  • Import each component’s README.md in its story and render it using the <Markdown> docs block above <ArgTypes />
  • Remove duplicate <Title /> usage where component headings are already in the README
  • Update Storybook host webpack config to load .md as raw source strings; update release workflow to restore Storybook build cache and import Storybook into Supernova

Reviewed changes

Copilot reviewed 116 out of 117 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/backpack-web/src/bpk-stylesheets/src/BpkStylesheetsFonts.stories.tsx Render stylesheets README in Docs page
packages/backpack-web/src/bpk-scrim-utils/src/BpkScrimUtils.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-visually-hidden/src/BpkVisuallyHidden.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-ticket/src/BpkTicket.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-thumb-button/src/BpkThumbButton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-theme-toggle/src/BpkThemeToggle.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-textarea/src/BpkTextarea.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-text/src/BpkText.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-table/src/BpkTable.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-switch/src/BpkSwitch.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-swap-button/src/BpkSwapButton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-star-rating/src/BpkStarRating.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-split-input/src/BpkSplitInput.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-spinner/src/BpkSpinner.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-snippet/src/BpkSnippet.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-slider/src/BpkSlider.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-skip-link/src/BpkSkipLink.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-skeleton/src/BpkSkeleton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-select/src/BpkSelect.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.stories.tsx Render segmented control v2 README in Docs page
packages/backpack-web/src/bpk-component-segmented-control/src/BpkSegmentedControl.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-section-list/src/BpkSectionList.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-section-header/src/BpkSectionHeader.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-rtl-toggle/src/BpkRtlToggle.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-rating/src/BpkRating.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-radio/src/BpkRadio.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-progress/src/BpkProgress.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-price/src/BpkPrice.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-price-range/src/BpkPriceRange.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-pressable/src/BpkPressable.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-popover/src/BpkPopover.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-phone-input/src/BpkPhoneInput.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-panel/src/BpkPanel.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-pagination/src/BpkPagination.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-page-indicator/src/BpkPageIndicator.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-overlay/src/BpkOverlay.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-nudger/src/BpkNudger.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-navigation-tab-group/src/BpkNavigationTabGroup.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-navigation-bar/src/BpkNavigationBar.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-modal/src/BpkModalV3/BpkModalV3.stories.tsx Render modal v3 README in Docs page
packages/backpack-web/src/bpk-component-modal/src/BpkModalV2/BpkModalV2.stories.tsx Render modal v2 README in Docs page
packages/backpack-web/src/bpk-component-modal/src/BpkModal.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-map/src/BpkMap.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-loading-button/src/BpkLoadingButton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-list/src/BpkList.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-link/src/BpkLink.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-layout/src/BpkVessel.stories.tsx Render layout README in Docs page
packages/backpack-web/src/bpk-component-layout/src/BpkStack.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-layout/src/BpkProvider.stories.tsx Replace default docs page with README-based page
packages/backpack-web/src/bpk-component-layout/src/BpkGrid.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-layout/src/BpkFlex.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-layout/src/BpkBox.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-label/src/BpkLabel.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-journey-arrow/src/BpkJourneyArrow.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBannerV3.stories.tsx Render v3 README in Docs page
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBannerV2/BpkInsetBannerSponsored.stories.tsx Render v2 README in Docs page
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBanner.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-input/src/BpkInput.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-info-banner/src/BpkInfoBanner.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-infinite-scroll/src/BpkInfiniteScroll.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-image/src/BpkImage.stories.js Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-icon/src/BpkIcon.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNav.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-grid-toggle/src/BpkGridToggle.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-graphic-promotion/src/BpkGraphicPromotion.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-form-validation/src/BpkFormValidation.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-floating-notification/src/BpkFloatingNotification.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-flare/src/BpkFlare.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-fieldset/src/BpkFieldset.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-divider/src/BpkDivider.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-dialog/src/BpkDialog.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-description-list/src/BpkDescriptionList.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-datepicker/src/BpkDatepicker.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-datatable/src/BpkDataTable.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-content-cards/src/BpkContentCards.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTable.stories.tsx Render local README in Docs page
packages/backpack-web/src/bpk-component-collapsible/src/BpkCollapsible.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-code/src/BpkCode.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-close-button/src/BpkCloseButton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chip/src/BpkChip.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chip-group/src/BpkChipGroup.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.stories.tsx Render v2 README in Docs page
packages/backpack-web/src/bpk-component-checkbox/src/BpkCheckbox.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-checkbox-card/src/BpkCheckboxCard.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chatbot-input/src/ChatDemo.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chatbot-input/src/BpkChatbotInput.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chat-notification/src/BpkChatNotification.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-chat-bubble/src/BpkChatBubble.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-carousel/src/BpkCarousel.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-card/src/BpkCardV2.stories.tsx Render local v2 README in Docs page
packages/backpack-web/src/bpk-component-card/src/BpkCard.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-card-list/src/BpkCardList.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-card-button/src/BpkCardButton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-calendar/src/BpkCalendar.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-button/src/BpkButton.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-bubble/src/BpkBubble.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-breakpoint/src/BpkBreakpoint.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-breadcrumb/src/BpkBreadcrumb.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-bottom-sheet/src/BpkBottomSheet.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-blockquote/src/BpkBlockquote.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-barchart/src/BpkBarchart.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-banner-alert/src/BpkBannerAlert.stories.js Render README in Docs page
packages/backpack-web/src/bpk-component-badge/src/BpkBadge.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-autosuggest/src/BpkAutosuggestV2/BpkAutosuggest.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-autosuggest/src/BpkAutosuggestLegacy.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-aria-live/src/BpkAriaLive.stories.tsx Remove <Title /> and render README in Docs
packages/backpack-web/src/bpk-component-ai-blurb/src/BpkAiBlurb.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-component-accordion/src/BpkAccordion.stories.tsx Render README in Docs page
packages/backpack-web/src/bpk-animate-height/src/BpkAnimateHeight.stories.tsx Render README in Docs page
libs/backpack-storybook-host/.storybook/main.ts Add webpack rule to import .md as raw source
@types/md.d.ts Add TS module declaration for *.md imports
.github/workflows/release.yml Restore build cache in publish job and run Supernova Storybook import
Comments suppressed due to low confidence (4)

packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.stories.tsx:1

  • The 'ts-expect-error' directive is not applied to any statement (blank line in between), which will cause TypeScript to error with an "Unused 'ts-expect-error' directive" failure. Move it to sit immediately above the specific import that needs suppression, or remove it entirely if nothing here is untyped. (This pattern appears in multiple updated story files and should be fixed consistently.)
    packages/backpack-web/src/bpk-component-page-indicator/src/BpkPageIndicator.stories.tsx:1
  • This 'ts-expect-error' is separated from the SCSS import by blank lines, so it won't suppress anything and will instead fail the build as an unused directive. Place the directive immediately above the SCSS import (or replace with an appropriate module declaration for '*.module.scss' if the repo prefers that).
    packages/backpack-web/src/bpk-component-input/src/BpkInput.stories.tsx:1
  • This change removes the previously inline Docs note about supporting native input attributes. If that information isn't already present in the imported README, it's a documentation regression for consumers. Consider reintroducing the note (either by keeping a small block here after , or by moving that note into the component README so it remains visible across all docs renderers).
    packages/backpack-web/src/bpk-component-image/src/BpkImage.stories.js:1
  • This update removes the previously inline Docs note linking to supported standard attributes (including srcSet). If that guidance isn't included in README.md, users lose an important API clarification. Prefer to preserve it by adding it into the README or keeping a small additional note in the custom docs page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Under React 19 types, @storybook/addon-docs/blocks is fully typed so
@ts-expect-error directives placed before that import became unused (TS2578).
The @types/md.d.ts added by the PR now types *.md imports, making any
suppressors before readme imports unused too.

Fixes: move @ts-expect-error to immediately precede bpk-storybook-utils
imports (which remain untyped), and remove orphaned suppressors before
now-typed imports across 52 stories files.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Three issues addressed from PR review:
- Remove invalid `cache: ''` from setup-node (cache poisoning warning from
  zizmor and invalid value per actions/setup-node); replaced with `cache: 'pnpm'`
  and added missing pnpm/action-setup step
- Add fallback: if the Storybook cache misses, install deps and rebuild
  Storybook so the import step never runs against a missing dist directory

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Comment thread .github/workflows/release.yml Resolved
Removing cache: 'pnpm' from the setup-node step in the SupernovaPublish
job to address a zizmor cache poisoning warning. Publishing jobs that
run on release triggers should not restore cached package stores, as a
tampered cache entry could flow into the published artifact.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
- Add native prop passthrough notes to BpkImage and BpkInput READMEs so
  the information previously shown inline in Storybook is preserved in
  the Docs tab via the README
- Move Supernova brandId and sourceId from hardcoded values to secrets
  (SUPERNOVA_BRAND_ID, SUPERNOVA_SOURCE_ID) so they can be changed via
  config rather than a code change
- Remove blank line inside JSX fragment before <Markdown> in 91 stories
  files (nit: extra blank line visible on every docs page)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
…vaPublish

Build already needs Create-Build-Cache, so SupernovaPublish depending on
Build is sufficient — the cache is guaranteed populated by the time Build
completes.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

…tore

Since Build (which runs before SupernovaPublish) already guarantees the
cache is populated, and the job has no pnpm cache for security reasons,
just build fresh every time. Removes the cache restore step and the
conditional fallback steps that were introduced alongside it.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Sets cache: '' and package-manager-cache: false to fully disable both
manual and automatic background package-manager detection caching,
preventing any cache poisoning vector in this publishing job.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@gc-skyscanner
GC Zhu (gc-skyscanner) merged commit f6cfccc into main Jul 17, 2026
15 checks passed
@gc-skyscanner
GC Zhu (gc-skyscanner) deleted the gert-janvercauteren/readme-in-storybook-v1 branch July 17, 2026 10:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants