question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Global types does not work as documented for HTML components

See original GitHub issue

Describe the bug The documented examples for exporting globalTypes in preview.js do not produce the documented results “you should see a new dropdown in your toolbar”. My hunch is this is down to @storybook/html not supporting this feature.

To Reproduce See repro here: https://github.com/maslade/storybook-toolbar-defect

  1. Clone above git repo, which is a bare HTML @storybook/html project with the sample code copied into preview.js.
  2. npm install && npm start
  3. Wait for Storybook to start

Expected behavior From the documentation:

When you start your Storybook, you should see a new dropdown in your toolbar with options light and dark.

Code snippets See git.

System Environment Info:

System: OS: Windows 10 10.0.18363 CPU: (8) x64 Intel® Core™ i7-2700K CPU @ 3.50GHz Binaries: Node: 14.7.0 - C:\Program Files\nodejs\node.EXE npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 87.0.4280.88 Edge: Spartan (44.18362.449.0) npmPackages: @storybook/html: ^6.1.11 => 6.1.11

Additional context The documentation I’m referring to is here: https://storybook.js.org/docs/html/essentials/toolbars-and-globals#global-types-and-the-toolbar-annotation

I see that @storybook/html doesn’t support controls - could this be why? If so - what is a good alternative for adding a global configuration?

My use case: my project has multiple SASS entry points, reflecting different brands. At the moment I’m importing one in preview.js, and editing the code (remembering not to commit) when I want to see a different brand. I’d like to put this in the UI so users can swap brands without

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
masladecommented, Dec 23, 2020

Will do - thanks to you both. I’ll send something through this weekend. Happy holidays.

0reactions
jonniebigodescommented, Jul 30, 2021

Closing this as it’s fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global attributes - HTML: HyperText Markup Language | MDN
Chrome Edge accesskey Full support. ChromeYes. Toggle history Full support. Edge12. Tog... autocapitalize Full support. Chrome43. Toggle history Full support. Edge79. Tog... autocomplete Full support. ChromeYes....
Read more >
Documentation - Global .d.ts - TypeScript
Global Libraries. A global library is one that can be accessed from the global scope (i.e. without using any form of import )....
Read more >
7 The global structure of an HTML document - W3C
The HTML 4.01 Strict DTD includes all elements and attributes that have not been deprecated or do not appear in frameset documents.
Read more >
Create a global variable in TypeScript - Stack Overflow
Using let will throw error TS2339: Property 'ENVIRONMENT' does not exist on type 'typeof globalThis'. You might notice that we declare d the...
Read more >
A Complete Introduction to Web Components in 2022 - Kinsta
Web Components are a standard way to create reusable and modular HTML elements without using a JavaScript framework.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found