UNPKG

@zeix/ui-element

Version:

UIElement - a HTML-first library for reactive Web Components

43 lines (22 loc) 886 B
[**@zeix/ui-element**](../README.md) *** [@zeix/ui-element](../globals.md) / setText # Function: setText() > **setText**\<`P`, `E`\>(`reactive`): [`Effect`](../type-aliases/Effect.md)\<`P`, `E`\> Defined in: [src/lib/effects.ts:378](https://github.com/zeixcom/ui-element/blob/297c0e8e040b3880ad85a2bc873523a8086f09a3/src/lib/effects.ts#L378) Effect for setting the text content of an element. Replaces all child nodes (except comments) with a single text node. ## Type Parameters ### P `P` *extends* [`ComponentProps`](../type-aliases/ComponentProps.md) ### E `E` *extends* `Element` = `HTMLElement` ## Parameters ### reactive [`Reactive`](../type-aliases/Reactive.md)\<`string`, `P`, `E`\> Reactive value bound to the text content ## Returns [`Effect`](../type-aliases/Effect.md)\<`P`, `E`\> Effect function that sets the text content of the element ## Since 0.8.0