Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource


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


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.


Save Automatically?

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.


                <div class="flex items-center justify-center w-full mb-6">
  <div id="app">
    <!-- Breed Options -->
    <div class="flex justify-center">
        v-for="(breed, i) in breeds"
        class="hover:bg-blue-500 text-sm py-1 px-2 border border-blue-500 rounded m-2"
          'text-blue-500 hover:text-white': breed.key !== breedKey,
          'bg-blue-500 text-white': breed.key === breedKey
        @click="currentBreed = i"
        {{ }}
    <div class="rounded shadow-md bg-gray-100 mt-4">
      <!-- Async Component -->
      <async :url="`${breedKey}/images`">

        <!-- Scoped Slot of Async Component -->
        <template v-slot:default="{ pending, error, data }">

          <!-- Request Pending -->
          <div v-if="pending" class="text-center">
            <img src="" alt="loading" class="mx-auto">
            <span class="text-gray-400 font-medium">Loading ...</span>

          <!-- Request Error -->
          <div v-else-if="error" class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4" role="alert">
            {{ error }}

          <!-- Request Success -->
          <ul v-else class="flex flex-wrap justify-between">
            <li v-for="(image, i) in data.message.slice(0,24)" :key="i" class="m-2">
              <img :src="image" class="rounded h-24" />

<div class="bg-gray-400 text-gray-600 px-4 py-3 rounded relative text-sm text-center"><a href="" class="text-blue-600 hover:underline">Follow me on Twitter</a></div>





 * Async Component
 * This is a renderless component.
 * It is an abstraction for GET requests.
 * Pass a mandatory "url" and an
 * optional "params" object.
const Async = Vue.component('async', {
  props: {
    url: { type: String, default: "", required: true },
    params: { type: Object, default: () => ({}) }
  data() {
    return {
      pending: true,
      error: false,
      data: null
  watch: {
    url() {
    params: {
      handler() {
      deep: true
  mounted() {
  methods: {
    async requestData() {
      this.pending = true;
      try {
        const { data } = await axios.get(this.url, { params: this.params }); =  data;
        this.error = false;
      } catch (e) { = null;
        this.error = e;
      this.pending = false;
  render() {
    return this.$scopedSlots.default({
      pending: this.pending,
      error: this.error,

 * Instantiate Vue App
new Vue({
  el: '#app',
  components: { Async },
  data() {
    return {
      currentBreed: 0,
      breeds: [
        { name: "Golden Retriever", key: "retriever/golden" },
        { name: "German Shepherd", key: "germanshepherd" },
        { name: "Husky", key: "husky" },
        { name: "Pug", key: "pug" },
        { name: "(Error)", key: "error" },
  computed: {
    breedKey() {
      return this.breeds[this.currentBreed].key;