> For the complete documentation index, see [llms.txt](https://docs.wem.io/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wem.io/platform/tutorials/building-widgets/basics/2-hello-world.md).

# 2. Hello, World!

When learning a new language, it is almost traditional to create a "Hello, World!" program as your first project. Let's do that too! Along the way, I will skip a few details here and there, but don't worry; I will explain them in detail in the upcoming chapters. So, let's create our first widget!

To create a widget, we need to open the Widget Editor and create a widget library first.

#### Opening the Widget Editor

1. Open or create a new WEM web project.
2. Select the "Templates, widgets, files, and hyperlinks" tab in the project tree.
3. Right-click on "Widget libraries" to display the context menu.
4. Click on "Open widget editor."

#### Creating a Widget Library

To create a widget, we first need to create a widget library:

1. Navigate to your workspace in the widget editor tree.
2. Right-click on your workspace to display the context menu.
3. Click on "Create library."
4. Let's name the library "Widget Academy."

#### Creating the Widget

Now let's create the widget:

1. Right-click on "Widget Academy" to display the context menu.
2. Click on "Create widget."
3. Name the widget "Hello, World!"

#### Almost There

1. Double-click on the newly created widget to open it.
2. Click on the Script tab.
3. Write the following HTML code in the code editor:

   ```html
   <h2>Hello, World!</h2>
   ```
4. Press Save.

Congratulations! You have created your first widget! But how do you see it in action? To view it, we need to add the widget library to our project. Once we do that, we can add the widget to the template in the template editor.

#### Adding the Widget Library to Your Project

1. Select the "Templates, widgets, files, and hyperlinks" tab in the project tree.
2. Right-click on "Widget libraries" to display the context menu.
3. Click on "Add widget library."
4. Select the "Widget Academy" library.
5. Press OK.

#### Placing the Widget on a Template

Now, let's place the widget on a template:

1. Create a new flowchart.
2. Create a new interaction node.
3. Drag and drop the "Custom" ribbon item (the one with the rocket) at the top of the template.
4. Expand the "Widget Academy" library.
5. Select the "Hello, World!" widget.
6. Press Select.
7. Save the template.

Now, preview this interaction node, and you will be greeted with the words:

**"Hello, World!"**

This widget may not be anything special. We didn't even write any WEMscript, nor did we discuss binding with the WEM data model. I skipped a lot of details. But if you’ve made it this far, then let the fun begin!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wem.io/platform/tutorials/building-widgets/basics/2-hello-world.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
