[]previous and next page

ssrTextArea

Renders the content of a <textarea> from its value: the helper compiled server output calls for <textarea value={...}> and defaultValue, since a browser ignores a value attribute on a textarea.

Renders the content of a <textarea> from its value: the helper compiled server output calls for <textarea value={...}> and defaultValue, since a browser ignores a value attribute on a textarea. The text is escaped, and a value that starts with a line break gets one more, because the HTML parser drops the first one.

Import#

ts
import { ssrTextArea } from "@shadow-js/web/server";

Signature#

ts
function ssrTextArea(value: unknown): SsrNode

Parameters#

Name Description
value The value, or an accessor of it. null and undefined give an empty textarea; anything else is written as String(value).

Returns#

The escaped content as a trusted SsrNode.

Throws#

  • TypeError UNRECOGNIZED_INSERT_VALUE when the value is a symbol.

Examples#

ts
import { renderToString, ssr, ssrTextArea } from "@shadow-js/web/server";

const bio = "Loves <b>tags</b>";
const html = renderToString(() => ssr(["<textarea>", "</textarea>"], ssrTextArea(bio)));
// "<textarea>Loves &lt;b&gt;tags&lt;/b&gt;</textarea>"