Form

A form lays out its fields in a column.

Default

A form stacks its children in a column with a gap in between. Handle onsubmit to read the values.

svelte
svelte
<Form onsubmit={submit}>
	<Field label="Name" name="name">
		<TextField bind:value={name} />
	</Field>
	<Field label="Email" name="email">
		<TextField bind:value={email} type="email" />
	</Field>
	<Button type="submit" appearance="primary">Send</Button>
	{#if sent}
		<span>Submitted</span>
	{/if}
</Form>

Width

The form takes 80% of the width of its container. Set width for another size.

svelte
svelte
<Form width="50%">
	<Field label="Name" name="name">
		<TextField bind:value={name} />
	</Field>
</Form>