Skip to main content

Part 1 / Bindings / Textarea inputs

The <textarea> element behaves similarly to a text input in Svelte — use bind:value:

App.svelte
<textarea bind:value={value}></textarea>

In cases like these, where the names match, we can also use a shorthand form:

App.svelte
<textarea bind:value></textarea>

This applies to all bindings, not just textareas.

Next: Select bindings

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<script>
	import { marked } from 'marked';
	let value = `Some words are *italic*, some are **bold**`;
</script>
 
{@html marked(value)}
 
<textarea {value}></textarea>
 
<style>
	textarea {
		width: 100%;
		height: 200px;
	}
</style>
 
initialising