add error box component

This commit is contained in:
Elijah Duffy
2025-07-16 17:33:02 -07:00
parent f55943d474
commit 20c1a4fa89
2 changed files with 19 additions and 0 deletions

18
src/lib/ErrorBox.svelte Normal file
View File

@@ -0,0 +1,18 @@
<script lang="ts">
import type { ClassValue } from 'svelte/elements';
import type { ErrorMessage } from './error';
interface Props {
error: ErrorMessage | null;
class?: ClassValue | null;
}
let { error, class: classValue }: Props = $props();
</script>
{#if error}
<!-- eslint-disable svelte/no-at-html-tags -->
<div class={['bg-sui-accent text-sui-background my-4 rounded-xs px-6 py-4', classValue]}>
{@html error.message}
</div>
{/if}

View File

@@ -6,6 +6,7 @@ export { default as Checkbox, type CheckboxState } from './Checkbox.svelte';
export { default as Combobox, type ComboboxOption } from './Combobox.svelte';
export { default as DateInput } from './DateInput.svelte';
export { default as Dialog } from './Dialog.svelte';
export { default as ErrorBox } from './ErrorBox.svelte';
export { default as FramelessButton } from './FramelessButton.svelte';
export { default as InjectGoogleMaps } from './InjectGoogleMaps.svelte';
export { default as InjectUmami } from './InjectUmami.svelte';