# Create/Compose Widgets

Make a class that inherits from `UUserWidget` (for layouts) or a specific widget like `UTextBlock` for extensions.

```csharp
[UClass]
public partial class UMyWidget : UUserWidget
{
}
```

Now add the child widgets to compose your widget.

The widgets you want to bind needs to have `UProperty` and `BindWidget` to work.

```csharp
[UClass]
public partial class UMyWidget : UUserWidget
{
    [UProperty, BindWidget]
    public partial UImage MyImage { get; set; }
    
    [UProperty, BindWidget]
    public partial UTextBlock MyTextBlock { get; set; }
}
```

In the Unreal Editor, create a new Widget Blueprint.

<figure><img src="https://4179970252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0wzkekwYXS1rYy7c988%2Fuploads%2Fu8w83nmCHQLTHaV4FDrT%2Fimage.png?alt=media&#x26;token=b3082654-9dd1-44a8-aed6-e135648a89b2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4179970252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0wzkekwYXS1rYy7c988%2Fuploads%2FvG3EKAkM3MBeLB52NWt8%2Fimage.png?alt=media&#x26;token=f6474d54-cd04-4ee1-9043-5e028d356f61" alt=""><figcaption></figcaption></figure>

When you have opened up the widget asset, you'll see compiler errors stating that the required widgets are missing.

<figure><img src="https://4179970252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0wzkekwYXS1rYy7c988%2Fuploads%2Fbn7rsFoXeUUaI7K3daJU%2Fimage.png?alt=media&#x26;token=d6365b62-57d1-4f53-9b1b-095ebc245cf6" alt=""><figcaption></figcaption></figure>

To resolve errors:

* Drag a widget element you want to bind from the **Palette** window into your **Hierarchy** (as shown in the image below)
* You must rename these spawned widgets to exactly match the property names in your C# code (in this case: `MyImage` and `MyTextBlock`).

<figure><img src="https://4179970252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0wzkekwYXS1rYy7c988%2Fuploads%2FpVKO5qs4ooWo2Gf2G9ge%2Fimage.png?alt=media&#x26;token=a8bba984-7820-499f-8005-f636ec17337e" alt=""><figcaption></figcaption></figure>

Hit Compile in the editor. The errors will disappear as the C# properties successfully "bind" to the newly spawned widgets.
