Skip to content
On this page

How to use the library with Vue?

To use the JS-Library with Vue, we need to convert the SVG to a data URI and use it as the src.

<script setup>
import { onMounted, ref } from 'vue';
import { createAvatar } from '@dicebear/core';
import { lorelei } from '@dicebear/collection';

const avatar = createAvatar(lorelei, {
  size: 128,
  // ... other options

  <img :src="avatar" alt="Avatar" />