PXD
v0.2.1-dev

Error Info

Good error design is clear, useful, and friendly. Designing concise and accurate error messages unblocks users and builds trust by meeting people where they are.

Default

This email address is already in use.
<template>
  <PErrorInfo>This email address is already in use.</PErrorInfo>
</template>

Custom Label

Email Error:This email address is already in use.
<template>
  <PErrorInfo label="Email Error">This email address is already in use.</PErrorInfo>
</template>

Sizes

This email is in use.
This email is in use.
This email is in use.
<template>
  <PStack direction="vertical">
    <PErrorInfo size="sm">This email is in use.</PErrorInfo>
    <PErrorInfo>This email is in use.</PErrorInfo>
    <PErrorInfo size="lg">This email is in use.</PErrorInfo>
  </PStack>
</template>

With an error property

Error:The request failed. Contact Us
<script setup>
import { ref } from 'vue'

const error = ref({
  message: 'The request failed.',
  action: 'Contact Us',
  label: 'Error',
  link: 'https://vercel.com/contact',
})
</script>

<template>
  <PErrorInfo :error="error" />
</template>

Card

Error:The request failed. Contact Us
<script setup>
import { ref } from 'vue'

const error = ref({
  message: 'The request failed.',
  action: 'Contact Us',
  label: 'Error',
  link: 'https://vercel.com/contact',
})
</script>

<template>
  <PErrorInfo variant="card" :error="error" />
</template>

Props

NameTypeDefaultDescription
size'xs' | 'sm' | 'md' | 'lg'-Font size of the message; falls back to the config provider size
labelstring | number | null-Bold prefix rendered before the message
errorErrorInfoType-Object with message plus an optional label, action and link
variantdefault|carddefaultcard centres the message in a bordered red panel

Slots

NameDescription
defaultDefault slot

Source

Source