elements icon indicating copy to clipboard operation
elements copied to clipboard

hideTryIt is greedy - Is it possible to hide the Try It panel, but keep the Examples panel?

Open junctionapps opened this issue 3 years ago • 4 comments

When setting the hideTryIt configuration in the element-api section like hideTryIt = "true", the inverted panel (with the dark background) is removed, but so too is the examples panel. Is it possible to just remove the panel with the Send API Request button in it but keep the examples? The 'response example' panel remains visible in both cases.

I've just discovered this project and it is great for my needs - thank you!

  • Version used: https://unpkg.com/@stoplight/elements/web-components.min.js

junctionapps avatar Sep 29 '22 15:09 junctionapps

I have similar needs, for the time being, one way to hide it is adding the following CSS to the HTML page: <style> .SendButtonHolder { display: none; visibility: hidden; } </style>

snowbug avatar Dec 29 '22 16:12 snowbug

This would be greatly appreciated. Although I'd like to hide the full TryIt panel and keep the full Request example panel that is below it.

EraYaN avatar Oct 18 '23 13:10 EraYaN

Try this code in your javascript:

const windowLoad = () => {
    setTimeout(() => {
        removeTestButton();
    }, 10);
};

const removeTestButton = () => {
    const button = document.querySelector(".SendButtonHolder").children[0];
    button.remove();
};

window.addEventListener("load", windowLoad);
window.addEventListener("hashchange", removeTestButton);

sirmerdas avatar Nov 09 '23 00:11 sirmerdas