# Kirbytag used in panel needs JavaScript

**URL:** <https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 1, 2022, 11:06am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881 "2022-07-01T11:06:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![teichsta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teichsta/32/10766_2.png) [@teichsta](https://forum.getkirby.com/u/teichsta)\
**Post date:** [July 1, 2022, 11:06am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/1 "2022-07-01T11:06:34Z")

</div>

Hi,

i recently created a custom kirbytag “overlay” which merely wirks like “link” but opens the link within an overlay. As we use [GLightbox | A touchable pure Javascript lightbox](https://biati-digital.github.io/glightbox/) in our frontend (Gallery) i tried to “simply” make it available in the panel … to no avail.

I tried to use the lib like described here [panel | Kirby CMS](https://getkirby.com/docs/reference/system/options/panel#custom-panel-js) but that didn’t work. In general we use `webpack` in combination with `mix` to compile the code which leads to three JS-files (custom.js + vendor.js + manifest.js) which needs to be referenced to.

As i not that fluent in the different build tools it would be great if someone could point me to a working example on how to integrate 3rd party JS libs in the panel.

Thanks in advance,

Thomas E.-E.

---

<div class="post-metadata">

**Author:** ![rasteiner](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rasteiner/32/4788_2.png) [@rasteiner](https://forum.getkirby.com/u/rasteiner)\
**Post date:** [July 1, 2022, 8:35pm UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/2 "2022-07-01T20:35:13Z")

</div>

Have you tried with kirbyup instead of webpack for the plugin? [GitHub - johannschopplich/kirbyup: 🆙 Zero-config bundler for Kirby Panel plugins](https://github.com/johannschopplich/kirbyup)

---

<div class="post-metadata">

**Author:** ![teichsta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teichsta/32/10766_2.png) [@teichsta](https://forum.getkirby.com/u/teichsta)\
**Post date:** [July 5, 2022, 6:15am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/3 "2022-07-05T06:15:08Z")

</div>

thanks @rasteiner in fact we use kirbyup to build our plugins. Reading through the kirbyup documentation i am quite unsure how this would be help to provide the exernal JS in the plugin. Any hint/example where this has been used already?

Thanks in advance, Thomas E.-E.

---

<div class="post-metadata">

**Author:** ![teichsta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teichsta/32/10766_2.png) [@teichsta](https://forum.getkirby.com/u/teichsta)\
**Post date:** [July 5, 2022, 7:26am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/4 "2022-07-05T07:26:05Z")

</div>

ok … 1 step further. What i did now is

- add a `package.json` and `yarn add glightbox`
- add `src/index.js` which imports the glightbox lib like
- which leads to a generated index.js which includes the `glightbox` code

but, the code is not available in the panel anymore meaning i didn’t find any script (tag) which includes the JS in the panel.

Any idea what needs to be done to get this working @rasteiner @texnixe ?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 5, 2022, 7:54am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/5 "2022-07-05T07:54:27Z")

</div>

Kirby creates a combined index.js from all plugins. You should see that get loaded in your dev tools network tab.

---

<div class="post-metadata">

**Author:** ![teichsta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teichsta/32/10766_2.png) [@teichsta](https://forum.getkirby.com/u/teichsta)\
**Post date:** [July 5, 2022, 8:19am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/6 "2022-07-05T08:19:34Z")

</div>

ok, got it … had some caching issues. After manual removal of the `media` folder i can see the plugin js code in the generated `http://<host>/media/plugins/index.js?1657003315`. Unfortunately the `lightbox` still doesn’t work as expected but this might be no kirby issue anymore …

---

<div class="post-metadata">

**Author:** ![rasteiner](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rasteiner/32/4788_2.png) [@rasteiner](https://forum.getkirby.com/u/rasteiner)\
**Post date:** [July 5, 2022, 8:21am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/7 "2022-07-05T08:21:44Z")

</div>

If you’re hoping that glightbox somehow will be able to initialize itself and apply itself to links or stuff, that won’t work. The panel is a single page app, and glightbox wouldn’t know what or when to do.

You included the library into your plugin. I imagine like this:

```auto
import GLightbox from 'glightbox';

```

You have now access to `GLightbox` inside your plugin, but that doesn’t mean it just automatically works with any link there might be in the panel.

---

<div class="post-metadata">

**Author:** ![teichsta](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teichsta/32/10766_2.png) [@teichsta](https://forum.getkirby.com/u/teichsta)\
**Post date:** [August 2, 2022, 8:23am UTC](https://forum.getkirby.com/t/kirbytag-used-in-panel-needs-javascript/25881/8 "2022-08-02T08:23:53Z")

</div>

wasn’t aware of this, thanks for the explanation @rasteiner.

How would you proceed to make this lighbox functionality available in the panel? Is there a way to achieve that? Appreciate your time and many thanks for any hint, link, tip you could give me to direct me into the right direction 🙂
