Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/trailheadapps/lwc-recipes/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The hello component demonstrates the most basic form of data binding in Lightning Web Components. It shows how to bind an HTML element to a component property using curly brace syntax {propertyName}.

What It Does

This component displays a simple greeting message by binding the greeting property to the template. The property value “World” is rendered inside the template, demonstrating one-way data binding from JavaScript to HTML.

Component Code

import { LightningElement } from 'lwc';

export default class Hello extends LightningElement {
    greeting = 'World';
}

Key Concepts

  • Property Declaration: The greeting property is declared as a class field with a default value
  • Data Binding: Curly braces {} are used to bind the property value to the template
  • One-Way Binding: Data flows from the JavaScript class to the HTML template

Usage Example

To use this component in your Salesforce org:
<c-hello></c-hello>
The component will render:
Hello, World!

Source Code

View the complete source code on GitHub:

Build docs developers (and LLMs) love