Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms

Form <pm-form>

Form helper around a native <form>: validation summary, busy submit button and server errors.

Full screen
I agree to the terms Create account

This component has no props to try here.

<script type="module"> import '@prismora/css'; import '@prismora/elements/button'; import '@prismora/elements/checkbox'; import '@prismora/elements/form'; import '@prismora/elements/input'; </script> <pm-form> <form class="pm-stack"> <pm-input label="Work email" name="email" type="email" required></pm-input> <pm-input label="Password" name="password" type="password" required minlength="8" hint="At least 8 characters."></pm-input> <pm-checkbox name="terms" required>I agree to the terms</pm-checkbox> <pm-button type="submit">Create account</pm-button> </form> </pm-form>

Overview

On submit it validates every field and lists the problems in an error summary that takes focus (each entry jumps to its field). It keeps the submit button busy while the request runs, and shows errors returned by the server on the right fields.

Listen for pm-submit; call event.detail.waitUntil(promise) for async work. A form without an action never reloads the page.

Attributes

AttributeTypeDefaultDescription
no-summary
prop: noSummary
boolean—Do not show the error summary; focus the first invalid field instead.
summary-title
prop: summaryTitle
string—Heading of the error summary (default "Please fix 2 fields", with the number of fields that have a problem).

Events

EventReact / Svelte propDescription
pm-invalidonPmInvalidSubmit was blocked. detail.fields lists the fields with a problem.
pm-submitonPmSubmitThe form is valid and was submitted.

Slots

SlotDescription
(default)One <form> with Prismora or native controls.

Methods

validate(), setErrors()