Vize

Result

Headless Result; covers Ant Design Result, shadcn/ui, Adobe Spectrum IllustratedMessage.

Package @vizejs/ui/result
Maturity stable
Quality gates behavior contract, mounted dom, type inference, tree shaking, bundle size, ssr, hydration, dom compile, ssr compile, vapor compile
Bundle budget 4,000 B JS gzip / 0 B CSS gzip
Own the source vize lib pull result
Requires —
Aliases result page, empty state, error page, 404
Covers Ant Design Result, shadcn/ui, Adobe Spectrum IllustratedMessage

Minimal setup

Use a Vue 3.5+ project with Vue SFC compilation configured (see Vite+ integration).

vp install @vizejs/ui

Add the public import below to <script setup lang="ts">. Components provide behavior without styles; the preview uses optional Paper styles.

import { Result } from "@vizejs/ui/result";

Or copy the source into your project with vize lib pull result (see Source Distribution).

Try it

This is the basic example maintained with the component source, using the public package imports. The preview adds the optional Paper styles.

Open the interactive example · Styling these components

Copy the example

<!-- Error, success, and not-found results. Only the error is an alert. -->
<script setup lang="ts">
import { Result } from "@vizejs/ui/result";
</script>

<template>
  <div>
    <Result status="success" title="Payment received" description="A receipt is on its way." />
    <Result status="error" title="Payment failed" description="The card was declined.">
      <button type="button">Try another card</button>
    </Result>
    <Result status="not-found" title="Page not found" />
  </div>
</template>

Reserve alerts for failures

Result is a status page. error is role="alert" so assistive tech interrupts. success, info, warning, not-found, and empty are role="status" so a missing page does not shout. The title is the accessible name.

<script setup lang="ts">
import { Result } from "@vizejs/ui/result";
</script>

<template>
  <Result status="not-found" title="Page not found" description="That URL is not on this site." />
  <Result v-slot="{ status }" status="error" title="Payment failed">
    <button type="button">Retry {{ status }}</button>
  </Result>
</template>

Style [data-vize-ui="result"] and [data-status]. The component ships no CSS.

API

Result

Source: src/components/result/result.vue

Props

Prop Type Default Description
status ResultStatus "info" Outcome. Only error uses role="alert". Every other status uses role="status".
title (required) string — Primary heading shown to the user.
description string undefined Supporting sentence. Omitted from the DOM when empty.

Slots

Slot Slot props Description
default ResultSlotProps Renders follow-up actions. Receives the current status.

Behavior

Normative state × input → outcome table for src/components/result/result.vue. Every row is proven by src/components/result/tests/behavior.test.ts.

# State Input Outcome Proven by
R1 error render role="alert", data-status="error", name from the title announces an error as an alert
R2 success render role="status", not an alert announces success as status
R3 not-found, empty render both use role="status" renders not-found and empty as status, not alerts
R4 description omitted render no description node omits an empty description
R5 any default slot slot receives the live status passes the status to the actions slot