Something went wrong. Try again.
wip: Custom mirroring tangled knot written in Rust
rust tangled mirror knot
Something went wrong. Try again.
889 B · 35 lines
TSX
at main
123456789101112131415161718192021222324252627282930313233343536import type { AnyFieldApi } from "@tanstack/solid-form";import { Show, splitProps } from "solid-js";import type { JSX } from "solid-js/jsx-runtime";
type Props = { id: string; field: AnyFieldApi;} & Omit<JSX.HTMLAttributes<HTMLParagraphElement>, "children" | "id">;
export function FormError(props: Props) { const [customProps, classProp, restProps] = splitProps( props, ["id", "field"], ["class"], );
return ( <Show when={customProps.field.state.meta.errors[0]}> {(first) => { const err = first(); return ( <p id={customProps.id} class={`text-red-400 font-semibold italic ${classProp.class}`} role="alert" aria-live="polite" {...restProps} > {typeof err === "string" ? err : err.message} </p> ); }} </Show> );}