You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Docs] Page template CodeSandbox examples are not working #8969
It might be feasible to add those files with ☝🏻 but we'd need to extract them from the imports. I don't think it's super straightforward but not that hard either.
@tkajtoch have you looked into this before? Does the approach I'm outlining make sense to you?
changed the title [-][docs] Page template CodeSandbox examples are not working[/-][+][Docs] Page template CodeSandbox examples are not working[/+]on Sep 2, 2025
Recap from our Triage session (repeats some of what Weronika already said above)
The Problem
Code Sandbox links in the EUI documentation are broken, an issue Weronika confirmed is widespread, affecting the entire "forms" category. The root cause is that these examples use local, relative-path imports for assets that are only used in the documentation, such as SVGs or a displayToggles helper component. Code Sandbox cannot resolve these imports because the local files do not exist in its virtual environment.
Tomasz noted that he he had already fixed most of these cases when converting examples previously but had skipped some that were too time-consuming. He also recalled that another team member had already fixed the displayToggles issue for some examples, so the team should look for that solution for reference.
The solution in general is to use our existing setup that allows us to include additional local files in the payload sent to Code Sandbox, which is necessary for any example using relative path imports. (Which I believe is what Weronika pointed out above).
However, Weronika noted, this solution may not work for displayToggles, which would be a very large file to send. Additionally, you can not selectively choose which example to send which files to ... all files we add currently get sent to all examples.
One option to consider would be to simply remove displayToggles from our examples. This is actually not a bad idea, since it typically makes the example code harder to understand for users.
Triage & Next Steps
The team agreed that fixing the broken examples is a worthwhile effort, as Code Sandbox is a critical part of the developer workflow. They estimated the effort to fix the known broken examples would be a couple of days, but could be more.
Because the work is documentation-related and doesn't need to be tied to a specific EUI release, they decided it would be a
great task to handle during a support week. Jason took the action item to recap the conversation in the GitHub issue and move it to the top of the backlog to be prioritized.
The solution in general is to use our existing setup that allows us to include additional local files (...)
However, Weronika noted, this solution may not work for displayToggles, which would be a very large file to send.
Sorry, just to clarify: I didn't say this method won't work for DisplayToggles. I said this about another method that I used when fixing some examples that didn't work in Codesandbox while we were getting EUI+ across the finish line. Simply by moving the code from the local file to the example code. That won't work for DisplayToggles because it's a big component. So we'd need to add it as a separate file to Codesandbox using the extraFiles.
He also recalled that another team member had already fixed the
displayToggles issue for some examples, so the team should look for that solution for reference.
Also, I asked @mgadewoll, @acstll and they don't remember fixing DisplayToggles for Codesandbox. I also verified that none of the examples that use DisplayToggles (all are in the Forms category) work.
Another idea, building on your proposal is to "move" DisplayToggles to the Demo component and make it configurable for every example. This way, the example code remains pure but we can customize the component using the toggles.
Activity
weronikaolejniczak commentedon Sep 2, 2025
Thanks for raising this, @cleydyr!
You are totally right, we have actually noticed this before but I don't think we have an issue open. Well, now we do...
The problem is that we're importing some files locally (mainly
.svgs) into examples but we don't add those to Codesandbox.eui/packages/docusaurus-theme/src/components/demo/codesandbox/open_action.tsx
Lines 75 to 132 in b4ff1a4
It might be feasible to add those files with ☝🏻 but we'd need to extract them from the imports. I don't think it's super straightforward but not that hard either.
@tkajtoch have you looked into this before? Does the approach I'm outlining make sense to you?
[-][docs] Page template CodeSandbox examples are not working[/-][+][Docs] Page template CodeSandbox examples are not working[/+]JasonStoltz commentedon Sep 16, 2025
A bunch of CodeSandbox examples are breaking on this page as well: https://eui.elastic.co/docs/components/display/icons/
JasonStoltz commentedon Sep 16, 2025
Forms as well
JasonStoltz commentedon Sep 17, 2025
Recap from our Triage session (repeats some of what Weronika already said above)
The Problem
Code Sandbox links in the EUI documentation are broken, an issue Weronika confirmed is widespread, affecting the entire "forms" category. The root cause is that these examples use local, relative-path imports for assets that are only used in the documentation, such as SVGs or a
displayToggleshelper component. Code Sandbox cannot resolve these imports because the local files do not exist in its virtual environment.Example:
displayToggles-eui/packages/website/docs/components/forms/selection/radio-and-radio-group.mdx
Line 122 in af5b2f5
Example: svg -
eui/packages/website/docs/components/templates/page-template/index.mdx
Lines 25 to 27 in af5b2f5
Proposed Solution & Technical Details
Tomasz noted that he he had already fixed most of these cases when converting examples previously but had skipped some that were too time-consuming. He also recalled that another team member had already fixed the
displayTogglesissue for some examples, so the team should look for that solution for reference.The solution in general is to use our existing setup that allows us to include additional local files in the payload sent to Code Sandbox, which is necessary for any example using relative path imports. (Which I believe is what Weronika pointed out above).
However, Weronika noted, this solution may not work for
displayToggles, which would be a very large file to send. Additionally, you can not selectively choose which example to send which files to ... all files we add currently get sent to all examples.One option to consider would be to simply remove displayToggles from our examples. This is actually not a bad idea, since it typically makes the example code harder to understand for users.
Triage & Next Steps
The team agreed that fixing the broken examples is a worthwhile effort, as Code Sandbox is a critical part of the developer workflow. They estimated the effort to fix the known broken examples would be a couple of days, but could be more.
Because the work is documentation-related and doesn't need to be tied to a specific EUI release, they decided it would be a
great task to handle during a support week. Jason took the action item to recap the conversation in the GitHub issue and move it to the top of the backlog to be prioritized.
weronikaolejniczak commentedon Sep 18, 2025
@JasonStoltz
Sorry, just to clarify: I didn't say this method won't work for
DisplayToggles. I said this about another method that I used when fixing some examples that didn't work in Codesandbox while we were getting EUI+ across the finish line. Simply by moving the code from the local file to the example code. That won't work forDisplayTogglesbecause it's a big component. So we'd need to add it as a separate file to Codesandbox using theextraFiles.Also, I asked @mgadewoll, @acstll and they don't remember fixing
DisplayTogglesfor Codesandbox. I also verified that none of the examples that useDisplayToggles(all are in the Forms category) work.Another idea, building on your proposal is to "move"
DisplayTogglesto theDemocomponent and make it configurable for every example. This way, the example code remains pure but we can customize the component using the toggles.