I'm extremely new to javascript and dat.gui so bear with me. I'm wondering how to create a drop down menu with a default value at the top:
so i have something like:
gui.add(text, 'language', ['english','spanish','french']);
How could I make that drop down say something like "Select Language" by default before actually selecting a value?
thanks!
After struggling a lot with a similar problem, I can tell you that I have no idea how to do specifically what you ask for with dat.GUI . However, you can select a default value like this:
let dropdown = gui.add(text, 'language', ['english','spanish','french']);
dropdown.setValue("french"); // cuz I like french better
I know this is an old question, but I hope it helps someone out there XD
Edit: you could also chain it all together :P
gui.add(text, “language”, [“english”, “spanish”, “french”]).setValue(“french”);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With