Skip to content

fix(docs): replace <ComponentsList /> in copy-page and markdown output#9484

Merged
shadcn merged 2 commits intoshadcn-ui:mainfrom
ramonclaudio:fix/docs-copy-page-components-list
Apr 8, 2026
Merged

fix(docs): replace <ComponentsList /> in copy-page and markdown output#9484
shadcn merged 2 commits intoshadcn-ui:mainfrom
ramonclaudio:fix/docs-copy-page-components-list

Conversation

@ramonclaudio
Copy link
Copy Markdown
Contributor

@ramonclaudio ramonclaudio commented Jan 29, 2026

Replaces <ComponentsList /> on /docs/components in both the Copy Page button and the /docs/components.md endpoint. Today the tag ships to the clipboard as-is and gets silently stripped to an empty string in the markdown endpoint, because getComponentsList() walked components.children for pages directly, and #9304 restructured the folder into components/radix/ and components/base/ subfolders so the filter returns [].

  • Reuse getPagesFromFolder from apps/v4/lib/page-tree.ts so this walker stays in sync with the on-screen ComponentsList React component if the tree shape changes again
  • Match the format already used in apps/v4/public/llms.txt: flat absolute URLs plus the MDX frontmatter description for each component. The flat URL is the canonical form because apps/v4/next.config.mjs:53 redirects /docs/components/:name to /docs/components/radix/:name (permanent: false, default-to-radix)
  • Export replaceComponentsList and call it from apps/v4/app/(app)/docs/[[...slug]]/page.tsx:87 so the Copy Page button and processMdxForLLMs share the same replacement path

Before

Copy Page button on ui.shadcn.com/docs/components (raw tag ships to clipboard):

---
title: Components
description: Here you can find all the components available in the library. We are working on adding more components.
---

<ComponentsList />

---

Can't find what you need? Try the [registry directory](/docs/directory) for community-maintained components.

https://ui.shadcn.com/docs/components.md (tag silently stripped to empty string, LLMs get a useless file):

---
title: Components
description: Here you can find all the components available in the library. We are working on adding more components.
---



---

Can't find what you need? Try the [registry directory](/docs/directory) for community-maintained components.

After

Copy Page and /docs/components.md with this PR (both identical, format matches llms.txt):

---
title: Components
description: Here you can find all the components available in the library. We are working on adding more components.
---

- [Accordion](https://ui.shadcn.com/docs/components/accordion): A vertically stacked set of interactive headings that each reveal a section of content.
- [Alert](https://ui.shadcn.com/docs/components/alert): Displays a callout for user attention.
- [Alert Dialog](https://ui.shadcn.com/docs/components/alert-dialog): A modal dialog that interrupts the user with important content and expects a response.
- [Button](https://ui.shadcn.com/docs/components/button): Displays a button or a component that looks like a button.
- ... 55 more

---

Can't find what you need? Try the [registry directory](/docs/directory) for community-maintained components.

Verification

  • pnpm test → 179 passed, 1 skipped
  • pnpm --filter=v4 dev, then Copy Page on /docs/components and curl http://localhost:4000/docs/components.md both return the same flat list of 59 components with absolute URLs and descriptions
  • Flat URLs work in both envs: local (http://localhost:4000/docs/components/accordion → 307 → /radix/accordion) and prod (https://ui.shadcn.com/docs/components/accordion → 307 → /radix/accordion)

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Jan 29, 2026

@ramonclaudio is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@shadcn
Copy link
Copy Markdown
Collaborator

shadcn commented Feb 2, 2026

hmm I thought I fixed this. Thanks for the PR. Will review.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ui Ready Ready Preview, Comment Apr 8, 2026 6:05pm

Request Review

@ramonclaudio
Copy link
Copy Markdown
Contributor Author

hmm I thought I fixed this. Thanks for the PR. Will review.

NP.

@ramonclaudio ramonclaudio force-pushed the fix/docs-copy-page-components-list branch 7 times, most recently from 2132259 to 21cab84 Compare February 3, 2026 16:50
@ramonclaudio
Copy link
Copy Markdown
Contributor Author

@shadcn anything I can do to help get this merged?

@ramonclaudio ramonclaudio force-pushed the fix/docs-copy-page-components-list branch 3 times, most recently from 65a5d3b to 1ff1203 Compare April 8, 2026 14:52
@ramonclaudio ramonclaudio changed the title fix(docs): copy-to-markdown outputs raw ComponentsList tag fix(docs): replace <ComponentsList /> in copy-page and markdown output Apr 8, 2026
@ramonclaudio ramonclaudio force-pushed the fix/docs-copy-page-components-list branch from 1ff1203 to 4a3a700 Compare April 8, 2026 15:27
The <ComponentsList /> tag on /docs/components was emitted as-is by
the Copy Page button and the /llm/[slug] markdown endpoint because
getComponentsList() walked components.children for pages directly.
After shadcn-ui#9304 restructured the folder into components/radix/ and
components/base/ subfolders, the filter always returned [] and the
tag was replaced with an empty string (or, in the copy-page case,
never replaced at all).

- Reuse getPagesFromFolder() from lib/page-tree so the walker stays
  in sync with the on-screen ComponentsList React component.
- Match the existing llms.txt format: flat absolute URLs (the
  /docs/components/:name -> /docs/components/radix/:name redirect in
  next.config.mjs is the canonical form) plus the frontmatter
  description pulled via source.getPage() on each page.
- Export replaceComponentsList() and call it from
  docs/[[...slug]]/page.tsx so the Copy Page button goes through the
  same replacement path as processMdxForLLMs.
@ramonclaudio ramonclaudio force-pushed the fix/docs-copy-page-components-list branch from 4a3a700 to 6d7a0ed Compare April 8, 2026 15:55
ramonclaudio added a commit to ramonclaudio/shadcn-ui that referenced this pull request Apr 8, 2026
These three components have shipped since llms.txt was added in shadcn-ui#8460
and were never listed. LLMs hitting /llms.txt get a catalog missing
them:

- Direction: text direction provider (RTL support)
- Native Select: styled native HTML select
- Sonner: opinionated toast (Toast uses it under the hood but Sonner
  is also exposed as its own component at /docs/components/sonner)

Noticed while working on shadcn-ui#9484.
ramonclaudio added a commit to ramonclaudio/shadcn-ui that referenced this pull request Apr 8, 2026
llms.txt was added in shadcn-ui#8460 and hasn't kept up with the docs tree.
Audited every section against apps/v4/content/docs and fixed the
drift in one pass.

Removed:
- About (/docs/about) returns 404, the mdx file doesn't exist

Added to Overview:
- Skills (/docs/skills)
- Directory (/docs/directory)

Added whole RTL section (new since shadcn-ui#8460):
- RTL (/docs/rtl)
- RTL - Next.js
- RTL - Vite
- RTL - TanStack Start

Added to Components:
- Direction (Misc)
- Native Select (Form & Input, after Select)
- Sonner (Feedback & Status, after Toast, since Sonner has its own
  docs page even though Toast already uses it under the hood)

Added to Registry:
- Namespaces
- Add a Registry (open source registry index)
- Open in v0 integration
- registry.json schema docs
- registry-item.json spec docs

Descriptions match the short curated style of the rest of the file.
Noticed while working on shadcn-ui#9484.
ramonclaudio added a commit to ramonclaudio/shadcn-ui that referenced this pull request Apr 8, 2026
llms.txt was added in shadcn-ui#8460 and hasn't kept up with the docs tree.
Audited every URL against apps/v4/content/docs and fixed the drift
in one pass.

Removed:
- About (/docs/about): returns 404, no about.mdx exists
- Form (/docs/components/form): points at a phantom. No radix/form.mdx
  exists post-shadcn-ui#9304. URL only resolves because of a redirect in
  next.config.mjs, which lands at /docs/forms. That page is already
  listed as 'Forms Overview' in the ## Forms section, and the real
  form library docs (React Hook Form, TanStack Form, Next.js) are
  listed there too. The Form component entry is a stale duplicate.

Added to Overview:
- Skills (/docs/skills)
- Directory (/docs/directory)

Added whole RTL section (new since shadcn-ui#8460):
- RTL (/docs/rtl)
- RTL - Next.js
- RTL - Vite
- RTL - TanStack Start

Added to Components:
- Direction (Misc)
- Native Select (Form & Input, after Select)
- Sonner (Feedback & Status, after Toast, since Sonner has its own
  docs page even though Toast already uses it under the hood)

Added to Registry:
- Namespaces
- Add a Registry (open source registry index)
- Open in v0 integration
- registry.json schema docs
- registry-item.json spec docs

Descriptions match the short curated style of the rest of the file.
Noticed while working on shadcn-ui#9484.
@shadcn shadcn merged commit d86c5e5 into shadcn-ui:main Apr 8, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants