import { Component } from '@angular/core';
import { WrResult, WrResult403, WrResult404, WrResult500 } from 'ngwr/result';
@Component({ imports: [WrResult, WrResult403, WrResult404, WrResult500] })
export class MyComponent {}Result
A full-size outcome screen, with ready-made 404, 403 and 500 pages.
Installation
Import the class, and @use the entry point in your global styles: without it the component renders unstyled.
Statuses
status is success, warning, error, info (default) or empty.
<wr-result status="success" title="Submitted" />
<wr-result status="warning" title="Heads up" />
<wr-result status="error" title="Failed" />
<wr-result status="info" title="In review" />
<wr-result status="empty" title="No projects" />With an action
Mark a projected button with wrResultExtra to offer the next step.
<wr-result status="success" title="Submitted!" description="We'll be in touch.">
<button wr-btn type="button" color="primary" wrResultExtra>Continue</button>
</wr-result>Presets
<wr-result-404>, <wr-result-403> and <wr-result-500> take title and description to replace their text.
<wr-result-404 />
<wr-result-403 />
<wr-result-500 />
<!-- Custom copy: -->
<wr-result-404 title="Lost?" description="That URL didn't lead anywhere." />API
| Name | Description | Type | Default |
|---|---|---|---|
title | The headline — the outcome in a few words. Pair it with description for the detail; a result with neither renders the illustration alone. | string | '' |
description | Secondary line under the title. Say what happens next, not what went wrong again — the title has already said it. | string | '' |
status | Which illustration and tint to draw. empty is the quiet one, for a list with nothing in it rather than for something that failed. | WrResultStatus | 'info' |
CSS variables
Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/result's own element.
| Variable | Default | Declared on |
|---|---|---|
--wr-result-description-font-size | var(--wr-text-sm) | .wr-result |
--wr-result-description-line-height | var(--wr-leading-relaxed) | .wr-result |
--wr-result-extra-gap | var(--wr-space-sm) | .wr-result |
--wr-result-extra-margin-top | var(--wr-space-sm) | .wr-result |
--wr-result-font-family | var(--wr-font-family-base) | .wr-result |
--wr-result-gap | var(--wr-space-md) | .wr-result |
--wr-result-padding-x | var(--wr-space-xl) | .wr-result |
--wr-result-padding-y | var(--wr-space-xl) | .wr-result |
--wr-result-title-font-size | var(--wr-text-2xl) | .wr-result |
--wr-result-title-font-weight | var(--wr-font-weight-semibold) | .wr-result |
--wr-result-title-letter-spacing | var(--wr-tracking-tight) | .wr-result |
--wr-result-title-line-height | var(--wr-leading-tight) | .wr-result |