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
- string
A unique identifier for the element.
Was this section helpful?
Anchor to eventsEvents
- Anchor to submitsubmit((event: CallbackEventListener<typeof tagName>) => void) | null
A callback that is run when the form is submitted.
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, TEvent>): void;
}) | null
CallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}
Was this section helpful?
Code
<s-form>
<s-text-field label="Email address" />
<s-button type="submit" variant="primary">Submit</s-button>
</s-form>
Examples
Code
Default
<s-form> <s-text-field label="Email address" /> <s-button type="submit" variant="primary">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?