# TraconUiBuilderExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.traconuibuilderextensions/
> Summary: TraconUiBuilderExtensions: Provides extensions that register the embedded management UI.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.UI.dll</code></div>

Provides extensions that register the embedded management UI.

```csharp
public static class TraconUiBuilderExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.traconuibuilderextensions/">TraconUiBuilderExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Methods

### <a id="Tracon_TraconUiBuilderExtensions_UseUI_Tracon_ITraconBuilder_"></a> UseUI\(ITraconBuilder\)

Registers the embedded management UI. `MapTracon` finds the
registration and binds the UI routes under the same prefix.

```csharp
public static ITraconBuilder UseUI(this ITraconBuilder builder)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon configuration chain.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Remarks

No separate mapping call is required. The prefix is written in one place -
inside `MapTracon` - because a prefix written in two places,
once out of sync, would make the UI show a blank page without any error.

Registration uses `TryAdd`, so calling `UseUI` twice registers
the UI once.

```csharp
builder.AddTracon()
       .UseOpenAI(apiKey)
       .UseUI();

app.MapTracon("/tracon");
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).
