Skip to main content

Form

Wraps one or more form controls and enables implicit submission, letting users submit the form from any input by pressing “Enter.” Unlike the HTML form element, this component doesn’t automatically submit data via HTTP. You must register a submit event to handle form submission in JavaScript.

string

A unique identifier for the element.

Was this section helpful?

((event: <typeof tagName>) => void) | null

A callback that is run when the form is submitted.

Was this section helpful?

Code

<s-form>
<s-text-field label="Email address" />
<s-button type="submit" variant="primary">Submit</s-button>
</s-form>

Preview

  • Wrap around all form input elements.
  • Forms can have only one submit button and it must be at the end of the form.
Was this section helpful?