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.

Option to turn off `Show code` & `Hide code` in the preview panel

See original GitHub issue

Is your feature request related to a problem? Please describe

  1. I’m creating ‘Design Tokens’ documentation page on Storybook.
  2. I’m creating a story representing a group of ‘Design tokens’, which isn’t the best looking code to preview, as it isn’t useful to the consumer to read or consume. See below:

E.g. () => { return ( <div css={{ maxWidth: 1080, margin: '20px auto' }}> <Table heads={Heading} rows={Object.keys(weight100).map((key) => ({ token: borders.100.${key}, value: weight100[key], example: weight100[key], }))} columnDecorations={{ example: DecorateSwatch, token: DecorateToken, }} showPagination={false} /> </div> ); }

  1. On the ‘Docs’ tab, I’m displaying the output, however consumers can expand the ‘show code’ panel, and view the setup code [see above], which isn’t required nor helpful to the consumer of the design system.
  2. I want to hide the ‘show code’ & ‘hide code’ functionality in this instance

Describe the solution you’d like

Configuration to hide this panel:

Screen Shot 2021-04-22 at 10 24 47 am

Describe alternatives you’ve considered

Are you able to assist to bring the feature to reality? Most likely not, happy to try.

Any help will be much appreciated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
tklivescommented, May 26, 2021

I’ll leave this here in case it can be of help to anyone else, because I’ve been unable to find anything about this.

If you don’t want the “Show/Hide Code” button to appear, just don’t wrap your <Story> in a <Canvas> element.

<Story name="Cool bro">
  <RadComponent />
</Story>

Then what renders is just your component without the border/shadow/button/etc., and it is still accessible from the left nav.

Right, wrong, or otherwise, this has worked for me!

3reactions
robstarbuckcommented, Oct 26, 2022

My current fix for this is:

<Canvas withSource="none">
  ...
</Canvas>

@shilman Thanks but your link now returns a 404

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removing the file preview on the right side of the editor in VS ...
Show activity on this post. Go to Preferences->Settings Under text-editor dropdown go to Minimap and there uncheck the enable of a minimap. ...
Read more >
How to hide minimap (preview bar) in visual studio code?
Go to View menu · Check or uncheck to show or hide minimap.
Read more >
Live Preview Window - Show/Hide? | Apple Developer Forums
Xcode Editor Menu has a Canvas option as well to toggle on or off. Posted 2 years ago by. Claude31.
Read more >
Visual Studio Code User Interface
You can also hide the Menu Bar on Windows and Linux with the View > Toggle Menu Bar command. This command sets window.menuBarVisibility...
Read more >
Editor basics | PhpStorm Documentation - JetBrains
In the editor, press Ctrl+Shift+F12 . PhpStorm hides all windows except the active editor. You can maximize a split screen as well. In...
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