Skip to content

feat(VSkeletonLoader): add types prop to v-skeleton-loader - #18878

Closed
MichaelGoff wants to merge 1 commit into
vuetifyjs:devfrom
MichaelGoff:feat/skeleton-types-prop
Closed

feat(VSkeletonLoader): add types prop to v-skeleton-loader#18878
MichaelGoff wants to merge 1 commit into
vuetifyjs:devfrom
MichaelGoff:feat/skeleton-types-prop

Conversation

@MichaelGoff

Copy link
Copy Markdown

Description

Vuetify 2 included the prop types which allowed you to define and use your own custom skeleton types with the existing types that Vuetify provides. This prop was not present in Vuetify 3.

In the component, I merge the custom types prop into the rootTypes and set that as a computed to keep it reactive.

I opted to move the gen* functions into setup to inherit the mergedTypes computed rather than pass it around as an extra parameter. Happy to set it up as a parameter instead if desired.

I'm not sure if there's anything I need to do on the documentation. I saw that there was already a description for the types prop in api-generator/src/locale/en/VSkeletonLoader.json

Markup:

<template>
  <v-app>
    <v-container>
      <v-skeleton-loader type="divider, packageList" class="package-list-skeleton-loader" :types="types" />
    </v-container>
  </v-app>
</template>

<script>
  export default {
    name: 'Playground',
    setup () {
      return {
        types: {
          packageDescription: 'sentences',
          packageMetadata: 'text',
          packageText: 'packageTitle, packageDescription, packageMetadata',
          packageTitle: 'text',
          packageList: 'thumbnail, packageText, button',
          thumbnail: 'image',
        },
      }
    },
  }
</script>

<style lang="scss">
.package-list-skeleton-loader {
  & .v-skeleton-loader__thumbnail {
    width: 150px;
    height: 100px;
  }
}
.v-skeleton-loader__packageList {
  align-content: center;
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 8px 16px;
  & .v-skeleton-loader__packageText {
    padding-left: 8px;
    padding-right: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;

    & .v-skeleton-loader__packageTitle {
      max-width: 50%;
    }

    & .v-skeleton-loader__packageDescription {
      padding-top: 8px;
    }

    & .v-skeleton-loader__packageMetadata {
      max-width: 25%;
      padding-top: 12px;
    }
  }
}
</style>

I merge the custom `types` prop into the `rootTypes` and set that as a computed to keep it reactive.

I opted to move the gen* functions into setup to inherit the `mergedTypes` computed rather than pass it around as an extra parameter. Happy to set it up as a parameter instead if desired.
@J-Sek

J-Sek commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

closing in favor of #23037

@J-Sek J-Sek closed this Jul 26, 2026
@J-Sek J-Sek removed this from the v4.x.x milestone Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants