Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="app" class="mx-auto flex space-x-10 flex-row w-4/5 py-10">
  <div class="flex flex-col space-y-5 w-full">

    <div class="flex flex-row justify-between items-center space-x-5">
      <label class="w-40 font-semibold" for="app-url">Application URL:</label>
      <input id="app-url" v-model="appUrl" type="text" placeholder="Application Url" class="flex flex-1 appearance-none w-full px-3 py-2 border border-gray-200 rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:text-gray-700 placeholder-gray-400 focus:ring-gray-900 focus:border-gray-900 focus:placeholder-gray-400" />
    </div>

    <div class="flex flex-row justify-between items-center space-x-5">
      <label class="w-40 font-semibold" for="app-id">Application ID:</label>
      <input id="app-id" v-model="appId" type="text" placeholder="Application id" class="flex flex-1 appearance-none w-full px-3 py-2 border border-gray-200 rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:text-gray-700 placeholder-gray-400 focus:ring-gray-900 focus:border-gray-900 focus:placeholder-gray-400" />
    </div>

    <div class="flex flex-row justify-between items-center space-x-5">
      <label class="w-40 font-semibold" for="app-key">API Key:</label>
      <input id="app-key" v-model="apiKey" type="text" placeholder="Token" class="flex flex-1 appearance-none w-full px-3 py-2 border border-gray-200 rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:text-gray-700 placeholder-gray-400 focus:ring-gray-900 focus:border-gray-900 focus:placeholder-gray-400" />
    </div>
  </div>
  <div class="flex flex-col space-y-5 w-full">
    <div class="flex-col space-y-4 items-center">
      <label class="font-semibold" for="index">Index</label>
      <input id="index" v-model="index" type="text" placeholder="index" class="flex flex-1 appearance-none w-full px-3 py-2 border border-gray-200 rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:text-gray-700 placeholder-gray-400 focus:ring-gray-900 focus:border-gray-900 focus:placeholder-gray-400" />
      <div class="flex-col space-y-4 items-center">
        <label class="font-semibold" for="search">Query</label>
        <input id="search" @keyup="search" type="text" placeholder="Search..." class="flex flex-1 appearance-none w-full px-3 py-2 border border-gray-200 rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5 focus:outline-none focus:text-gray-700 placeholder-gray-400 focus:ring-gray-900 focus:border-gray-900 focus:placeholder-gray-400" />
      </div>
      <div class="flex flex-col p-2">
        <div id="tree"></div>
      </div>
    </div>
  </div>
              
            
!

CSS

              
                <style> 
</style>
              
            
!

JS

              
                import axios from "https://cdn.skypack.dev/axios@1.0.0";
import jsonview from "https://cdn.skypack.dev/@pgrabovets/json-view@2.7.1";
      
new Vue({
  el: "#app",
  mounted() {},
  data: {
    query: "",
    index: "",
    appId: "",
    apiKey: "",
    appUrl: "",
    response: {},
    tree: null
  },
  methods: {
    renderTree() {
      jsonview.render(this.tree, document.querySelector("#tree"));
    },
    async search(e) {
      let value = e.target.value;

      const instance = axios.create({
        baseURL: this.appUrl,
        timeout: 10000,
        headers: {
          "Content-Type": "application/json",
          "X-Sigmie-API-Key": this.apiKey,
          "X-Sigmie-Application": this.appId
        }
      });

      let res = await instance.post(`/v1/search/${this.index}`, {
        query: value,
        per_page: 10
      });

      this.response = res.data;

      if (this.tree) {
        jsonview.destroy(this.tree);
      }

      this.tree = jsonview.create(res.data.hits);

      this.renderTree();
    }
  }
});

              
            
!
999px

Console