Files
WRNexusJSDoc/app/pages/components/error-state.wrn
T
2026-07-22 01:56:18 +05:30

217 lines
19 KiB
Plaintext

page ErrorStatecomponent {
seo {
title = "ErrorState component"
description = "Reusable error state component."
}
view {
<div class="docs-shell">
<SkipLink label="Skip to content" href="#main" class="docs-skip-link" />
<header class="topbar">
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/components">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.2.77</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
</header>
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/components">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
<main class="portal-main docs-layout component-detail-page"><article id="main" class="documentation prose standalone"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/components">Components</a><span>/</span><span aria-current="page">ErrorState</span></nav><section class="doc-intro"><span class="eyebrow">feedback component</span><h1>ErrorState</h1><p>Reusable error state component.</p><div class="doc-meta"><span>@wrnexus/ui 0.2.77</span><span>16 props</span><span>0 slots</span><span>1 events</span></div></section><section id="usage"><h2>Usage</h2><p>Components are auto-discovered. Use the component directly in any <code>.wrn</code> view:</p><pre data-language="wrn"><code>&lt;ErrorState
type=&quot;error&quot;
eyebrow=&quot;eyebrow&quot;
title=&quot;Something went wrong&quot;
description=&quot;description&quot;
errorCode=&quot;errorCode&quot;
/&gt;</code></pre><p>Legacy mount name: <code>data-component=&quot;ErrorState&quot;</code>.</p></section><section id="props"><h2>Props and attributes</h2><div class="table-wrap"><table><thead><tr><th>Prop</th><th>Type</th><th>Requirement</th><th>Default</th></tr></thead><tbody><tr><td><code>class</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>type</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;error&quot;</code></td></tr><tr><td><code>eyebrow</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;Something went wrong&quot;</code></td></tr><tr><td><code>description</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>errorCode</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>iconClass</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>primaryLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>primaryHref</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>secondaryLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>secondaryHref</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>retryLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>retryAction</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>centered</code></td><td><code>boolean</code></td><td>Optional</td><td><code>true</code></td></tr><tr><td><code>compact</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>details</code></td><td><code>string</code></td><td>Optional</td><td><code>[]</code></td></tr></tbody></table></div></section><section id="slots"><h2>Slots</h2><p>This component does not declare a slot.</p></section><section id="events"><h2>Events</h2><ul><li><code>click</code></li></ul></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/ErrorState.wrn</code></p><pre data-language="wrn"><code>component ErrorState &#123;
props &#123;
class: string = &quot;&quot;
type = &quot;error&quot;
eyebrow = &quot;&quot;
title = &quot;Something went wrong&quot;
description = &quot;&quot;
errorCode = &quot;&quot;
iconClass = &quot;&quot;
primaryLabel = &quot;&quot;
primaryHref = &quot;&quot;
secondaryLabel = &quot;&quot;
secondaryHref = &quot;&quot;
retryLabel = &quot;&quot;
retryAction = &quot;&quot;
centered = true
compact = false
details = []
&#125;
view &#123;
&lt;section
aria-labelledby=&quot;error-state-title&quot;
role=&quot;&#123;type === 'error' ? 'alert' : 'status'&#125;&quot;
class=&quot;w-full &#123;class&#125;&quot;
class:py-6=&quot;compact&quot;
class:sm:py-8=&quot;compact&quot;
class:py-8=&quot;!compact&quot;
class:sm:py-10=&quot;!compact&quot;
&gt;
&lt;div
class=&quot; relative w-full overflow-hidden rounded-3xl border shadow-xl &#123;type === 'warning' ? 'border-amber-200/80 bg-linear-to-br from-amber-50 via-white to-orange-50 shadow-amber-950/5 dark:border-amber-500/20 dark:from-amber-500/10 dark:via-slate-900 dark:to-orange-500/10' : type === 'forbidden' ? 'border-violet-200/80 bg-linear-to-br from-violet-50 via-white to-indigo-50 shadow-violet-950/5 dark:border-violet-500/20 dark:from-violet-500/10 dark:via-slate-900 dark:to-indigo-500/10' : type === 'offline' ? 'border-slate-200 bg-linear-to-br from-slate-100 via-white to-indigo-50 shadow-slate-950/5 dark:border-white/10 dark:from-white/5 dark:via-slate-900 dark:to-indigo-500/10' : 'border-rose-200/80 bg-linear-to-br from-rose-50 via-white to-orange-50 shadow-rose-950/5 dark:border-rose-500/20 dark:from-rose-500/10 dark:via-slate-900 dark:to-orange-500/10' &#125; &quot;
class:mx-auto=&quot;centered&quot;
class:max-w-3xl=&quot;centered&quot;
&gt;
&lt;!-- Decorative background --&gt;
&lt;div
aria-hidden=&quot;true&quot;
class=&quot;pointer-events-none absolute inset-0 overflow-hidden&quot;
&gt;
&lt;div class=&quot; absolute -right-20 -top-24 h-64 w-64 rounded-full blur-3xl &#123;type === 'warning' ? 'bg-amber-300/25 dark:bg-amber-500/10' : type === 'forbidden' ? 'bg-violet-300/25 dark:bg-violet-500/10' : type === 'offline' ? 'bg-slate-300/25 dark:bg-slate-500/10' : 'bg-rose-300/25 dark:bg-rose-500/10' &#125; &quot; &gt;
&lt;/div&gt;
&lt;div class=&quot; absolute -bottom-28 -left-20 h-64 w-64 rounded-full blur-3xl &#123;type === 'warning' ? 'bg-orange-300/20 dark:bg-orange-500/10' : type === 'forbidden' ? 'bg-indigo-300/20 dark:bg-indigo-500/10' : type === 'offline' ? 'bg-indigo-300/15 dark:bg-indigo-500/5' : 'bg-orange-300/20 dark:bg-orange-500/10' &#125; &quot; &gt;
&lt;/div&gt;
&lt;div class=&quot; absolute left-1/2 top-0 h-px w-2/3 -translate-x-1/2 bg-linear-to-r from-transparent to-transparent &#123;type === 'warning' ? 'via-amber-400/60 dark:via-amber-400/20' : type === 'forbidden' ? 'via-violet-400/60 dark:via-violet-400/20' : type === 'offline' ? 'via-slate-400/50 dark:via-slate-400/20' : 'via-rose-400/60 dark:via-rose-400/20' &#125; &quot; &gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div
class=&quot;relative&quot;
class:px-6=&quot;compact&quot;
class:py-8=&quot;compact&quot;
class:sm:px-8=&quot;compact&quot;
class:sm:py-9=&quot;compact&quot;
class:px-6=&quot;!compact&quot;
class:py-10=&quot;!compact&quot;
class:sm:px-10=&quot;!compact&quot;
class:sm:py-12=&quot;!compact&quot;
class:lg:px-12=&quot;!compact&quot;
class:text-center=&quot;centered&quot;
class:text-left=&quot;!centered&quot;
&gt;
&lt;div class=&quot;&#123;compact ? 'max-w-xl' : 'max-w-2xl'&#125; &#123;centered ? 'mx-auto' : 'mr-auto'&#125;&quot; &gt;
&lt;!-- Icon --&gt;
&lt;div
class=&quot;flex&quot;
class:justify-center=&quot;centered&quot;
class:justify-start=&quot;!centered&quot;
&gt;
&lt;div class=&quot;relative&quot;&gt;
&lt;div aria-hidden=&quot;true&quot; class=&quot; absolute inset-1 rounded-2xl blur-xl &#123;type === 'warning' ? 'bg-amber-500/25' : type === 'forbidden' ? 'bg-violet-500/25' : type === 'offline' ? 'bg-slate-500/20' : 'bg-rose-500/25' &#125; &quot; &gt;
&lt;/div&gt;
&lt;span
class=&quot; relative grid place-items-center rounded-2xl border bg-white/90 shadow-lg backdrop-blur-sm &#123;compact ? 'h-12 w-12' : 'h-14 w-14'&#125; &#123;type === 'warning' ? 'border-amber-200 text-amber-700 shadow-amber-950/10 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-300' : type === 'forbidden' ? 'border-violet-200 text-violet-700 shadow-violet-950/10 dark:border-violet-500/20 dark:bg-violet-500/10 dark:text-violet-300' : type === 'offline' ? 'border-slate-200 text-slate-700 shadow-slate-950/10 dark:border-white/10 dark:bg-white/5 dark:text-slate-300' : 'border-rose-200 text-rose-700 shadow-rose-950/10 dark:border-rose-500/20 dark:bg-rose-500/10 dark:text-rose-300' &#125; &quot;
&gt;
&lt;span class=&quot; &#123;compact ? 'h-5 w-5' : 'h-6 w-6'&#125; &#123;iconClass !== '' ? iconClass : type === 'warning' ? 'icon-[lucide--triangle-alert]' : type === 'forbidden' ? 'icon-[lucide--shield-alert]' : type === 'offline' ? 'icon-[lucide--wifi-off]' : 'icon-[lucide--circle-x]' &#125; &quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;!-- Error code --&gt;
&lt;div
class=&quot;mt-5 flex&quot;
class:hidden=&quot;errorCode === ''&quot;
class:justify-center=&quot;centered&quot;
class:justify-start=&quot;!centered&quot;
&gt;
&lt;span
class=&quot; rounded-full px-3 py-1 text-xs font-bold tracking-[0.14em] &#123;type === 'warning' ? 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300' : type === 'forbidden' ? 'bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300' : type === 'offline' ? 'bg-slate-200 text-slate-700 dark:bg-white/10 dark:text-slate-300' : 'bg-rose-100 text-rose-700 dark:bg-rose-500/15 dark:text-rose-300' &#125; &quot;
&gt;
&#123;errorCode&#125;
&lt;/span&gt;
&lt;/div&gt;
&lt;!-- Eyebrow --&gt;
&lt;p
class=&quot; text-xs font-bold uppercase tracking-[0.18em] &#123;errorCode !== '' ? 'mt-4' : 'mt-5'&#125; &#123;type === 'warning' ? 'text-amber-700 dark:text-amber-400' : type === 'forbidden' ? 'text-violet-700 dark:text-violet-400' : type === 'offline' ? 'text-slate-600 dark:text-slate-400' : 'text-rose-700 dark:text-rose-400' &#125; &quot;
class:hidden=&quot;eyebrow === ''&quot;
&gt;
&#123;eyebrow&#125;
&lt;/p&gt;
&lt;!-- Title --&gt;
&lt;h2
id=&quot;error-state-title&quot;
class=&quot; font-bold leading-tight tracking-tight text-slate-950 dark:text-white &#123;eyebrow !== '' || errorCode !== '' ? 'mt-3' : 'mt-5'&#125; &#123;compact ? 'text-xl sm:text-2xl' : 'text-2xl sm:text-3xl lg:text-[2rem]'&#125; &quot;
&gt;
&#123;title&#125;
&lt;/h2&gt;
&lt;!-- Description --&gt;
&lt;p
class=&quot; mt-3 max-w-xl text-sm leading-6 text-slate-600 dark:text-slate-400 &#123;!compact ? 'sm:text-base sm:leading-7' : ''&#125; &#123;centered ? 'mx-auto' : 'mr-auto'&#125; &quot;
class:hidden=&quot;description === ''&quot;
&gt;
&#123;description&#125;
&lt;/p&gt;
&lt;!-- Details --&gt;
&lt;div
class=&quot;mt-6 flex flex-wrap gap-x-5 gap-y-3&quot;
class:hidden=&quot;details.length === 0&quot;
class:justify-center=&quot;centered&quot;
class:justify-start=&quot;!centered&quot;
&gt;
&#123;#each details.slice(0, 4) as detail&#125;
&lt;div class=&quot;inline-flex items-center gap-2 text-sm font-medium text-slate-600 dark:text-slate-300&quot;&gt;
&lt;span
class=&quot; grid h-6 w-6 shrink-0 place-items-center rounded-full &#123;type === 'warning' ? 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300' : type === 'forbidden' ? 'bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300' : type === 'offline' ? 'bg-slate-200 text-slate-700 dark:bg-white/10 dark:text-slate-300' : 'bg-rose-100 text-rose-700 dark:bg-rose-500/15 dark:text-rose-300' &#125; &quot;
&gt;
&lt;span class=&quot;&#123;detail.iconClass&#125; h-3.5 w-3.5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&#123;detail.label&#125;
&lt;/div&gt;
&#123;/each&#125;
&lt;/div&gt;
&lt;!-- Actions --&gt;
&lt;div
class=&quot;mt-7 flex flex-col gap-3 sm:flex-row&quot;
class:hidden=&quot;primaryLabel === '' &amp;&amp; secondaryLabel === '' &amp;&amp; retryLabel === ''&quot;
class:justify-center=&quot;centered&quot;
class:justify-start=&quot;!centered&quot;
&gt;
&lt;!-- Secondary --&gt;
&lt;a
href=&quot;&#123;secondaryHref&#125;&quot;
class=&quot;h-11 items-center justify-center rounded-xl border border-slate-200 bg-white/90 px-4 text-sm font-semibold text-slate-700 shadow-sm backdrop-blur-sm transition hover:-translate-y-0.5 hover:border-indigo-300 hover:bg-white hover:text-indigo-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 dark:hover:border-indigo-500/30 dark:hover:bg-white/10 dark:hover:text-indigo-300&quot;
class:hidden=&quot;secondaryLabel === ''&quot;
class:inline-flex=&quot;secondaryLabel !== ''&quot;
&gt;
&#123;secondaryLabel&#125;
&lt;/a&gt;
&lt;!-- Retry --&gt;
&lt;button
type=&quot;button&quot;
@click=&quot;&#123;retryAction&#125;&quot;
class=&quot; group h-11 items-center justify-center gap-2 rounded-xl px-4 text-sm font-bold text-white shadow-lg transition hover:-translate-y-0.5 hover:shadow-xl focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 &#123;type === 'warning' ? 'bg-amber-600 shadow-amber-600/20 hover:bg-amber-500 focus-visible:ring-amber-500' : type === 'forbidden' ? 'bg-violet-600 shadow-violet-600/20 hover:bg-violet-500 focus-visible:ring-violet-500' : type === 'offline' ? 'bg-slate-800 shadow-slate-900/20 hover:bg-slate-700 focus-visible:ring-slate-500 dark:bg-slate-200 dark:text-slate-950 dark:hover:bg-white' : 'bg-rose-600 shadow-rose-600/20 hover:bg-rose-500 focus-visible:ring-rose-500' &#125; &quot;
class:hidden=&quot;retryLabel === ''&quot;
class:inline-flex=&quot;retryLabel !== ''&quot;
&gt;
&lt;span class=&quot;icon-[lucide--rotate-cw] h-4 w-4 transition-transform group-hover:rotate-45&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&#123;retryLabel&#125;
&lt;/button&gt;
&lt;!-- Primary link --&gt;
&lt;a
href=&quot;&#123;primaryHref&#125;&quot;
class=&quot; group h-11 items-center justify-center gap-2 rounded-xl px-4 text-sm font-bold text-white shadow-lg transition hover:-translate-y-0.5 hover:shadow-xl focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 &#123;type === 'warning' ? 'bg-amber-600 shadow-amber-600/20 hover:bg-amber-500 focus-visible:ring-amber-500' : type === 'forbidden' ? 'bg-violet-600 shadow-violet-600/20 hover:bg-violet-500 focus-visible:ring-violet-500' : type === 'offline' ? 'bg-slate-800 shadow-slate-900/20 hover:bg-slate-700 focus-visible:ring-slate-500 dark:bg-slate-200 dark:text-slate-950 dark:hover:bg-white' : 'bg-rose-600 shadow-rose-600/20 hover:bg-rose-500 focus-visible:ring-rose-500' &#125; &quot;
class:hidden=&quot;primaryLabel === ''&quot;
class:inline-flex=&quot;primaryLabel !== ''&quot;
&gt;
&#123;primaryLabel&#125;
&lt;span class=&quot;icon-[lucide--arrow-right] h-4 w-4 transition-transform group-hover:translate-x-1&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;
&#125;
&#125;
</code></pre></section></article><aside class="on-this-page"><h2>On this page</h2><nav><a href="#usage">Usage</a><a href="#props">Props and attributes</a><a href="#slots">Slots</a><a href="#events">Events</a><a href="#source">Source contract</a></nav></aside></main>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.2.77</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
<BackToTop />
</div>
}
}