VOOZH about

URL: https://www.geeksforgeeks.org/javascript/vue-js-v-text-directive/

⇱ Vue.js | v-text directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Vue.js | v-text directive

Last Updated : 15 Jul, 2025

The v-text directive is a Vue.js directive used to update a element’s textContent with our data. It is just a nice alternative to Mustache syntax. First, we will create a div element with id as app and let's apply the v-text directive to this element with data as a message. Now we will create this message by initializing a Vue instance the data attribute containing our message.


Syntax: 

v-text="data"


Parameters: This directive accepts a single parameter which is the data.
Example: This example uses VueJS to update the text of a element with v-text. 

Output: 

👁 Image
Comment
Article Tags: