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.
Anchor to propertiesProperties
- Anchor to disableddisabledbooleanDefault: false
Whether the form is able to be submitted.
When set to
true
, this will also disable the implicit submit behavior of the form.- string
A unique identifier for the element.
FormElementProps
- disabled
Whether the form is able to be submitted. When set to `true`, this will also disable the implicit submit behavior of the form.
boolean
- id
A unique identifier for the element.
string
export interface FormElementProps extends Pick<FormProps$1, 'id' | 'disabled'> {
}
Was this section helpful?
Code
<s-form onSubmit="console.log('Form submitted'); return false;">
<s-text-field label="Email address" />
<s-button accessibilityRole="submit">Submit</s-button>
</s-form>
examples
Code
<s-form onSubmit="console.log('Form submitted'); return false;"> <s-text-field label="Email address" /> <s-button accessibilityRole="submit">Submit</s-button> </s-form>
Preview

Anchor to best-practicesBest Practices
- 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?