# UIMenu

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/instanceinterface">Sansar.Script.InstanceInterface</a></span>
<span class="api-badge api-since">Added in 47.1.1</span>
</div>

<span id="T:Sansar.Simulation.UIMenu"></span>

Manages a clickable on-screen menu UI element.

```csharp
public class UIMenu : Sansar.Script.InstanceInterface
```

## Remarks

Use this for text-heavy game menus, voting prompts, settings panels, or non-interactive leaderboards.

## Members at a glance

| Kind | Members |
|---|---|
| **Fields** | [cMaxItems](#cmaxitems) |
| **Properties** | [Footer](#footer) · [SelectedIndex](#selectedindex) · [SelectedItem](#selecteditem) · [Subtitle](#subtitle) · [Title](#title) |
| **Methods** | [Hide](#hide) · [Show](#show) · [ShowStyled](#showstyled) · [ToString](#tostring) |

## Fields

### cMaxItems

<div class="api-card">
<span id="F:Sansar.Simulation.UIMenu.cMaxItems"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public static readonly int cMaxItems
```

Maximum number of menu items allowed per menu.

</div>


## Properties

### Footer

<div class="api-card">
<span id="P:Sansar.Simulation.UIMenu.Footer"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public string Footer { get; }
```

The current menu footer.

</div>

### SelectedIndex

<div class="api-card">
<span id="P:Sansar.Simulation.UIMenu.SelectedIndex"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public int SelectedIndex { get; }
```

The zero-based index of the last selected menu item, or -1 if none selected.

</div>

### SelectedItem

<div class="api-card">
<span id="P:Sansar.Simulation.UIMenu.SelectedItem"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public string SelectedItem { get; }
```

The label of the last selected menu item.

</div>

### Subtitle

<div class="api-card">
<span id="P:Sansar.Simulation.UIMenu.Subtitle"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public string Subtitle { get; }
```

The current menu subtitle.

</div>

### Title

<div class="api-card">
<span id="P:Sansar.Simulation.UIMenu.Title"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public string Title { get; }
```

The current menu title.

</div>


## Methods

### Hide

<div class="api-card">
<span id="M:Sansar.Simulation.UIMenu.Hide"></span>
<span id="M:Sansar.Simulation.UIMenu.Hide()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void Hide()
```

Hide the current menu.

</div>

### Show

<div class="api-card" id="show-string-string-string-object-single-single-boolean-boolean">
<span id="M:Sansar.Simulation.UIMenu.Show(System.String,System.String,System.String,System.Object[],System.Single,System.Single,System.Boolean,System.Boolean)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void Show(
    string title,
    string subtitle,
    string footer,
    object[] items,
    float positionXPercent,
    float positionYPercent,
    bool interactive,
    bool closeOnSelection
)
```

Show a scriptable menu using the default client theme.

| Parameter | Type | Description |
|---|---|---|
| `title` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Primary header text. |
| `subtitle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional secondary header text. |
| `footer` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional footer or hint text. |
| `items` | [object](https://learn.microsoft.com/dotnet/api/system.object)\[\] | List of rows to display. |
| `positionXPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Horizontal menu center position in percent of screen width. |
| `positionYPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Vertical menu center position in percent of screen height. |
| `interactive` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If false, the menu becomes a click-through display panel. |
| `closeOnSelection` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If true, the menu closes on the first click. |

<details class="api-remarks"><summary>Remarks</summary>

Call this with WaitFor to block until the first menu row is clicked.

</details>

</div>

<div class="api-card" id="show-string-string-string-object-single-single-boolean-boolean-action">
<span id="M:Sansar.Simulation.UIMenu.Show(System.String,System.String,System.String,System.Object[],System.Single,System.Single,System.Boolean,System.Boolean,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void Show(
    string title,
    string subtitle,
    string footer,
    object[] items,
    float positionXPercent,
    float positionYPercent,
    bool interactive,
    bool closeOnSelection,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Show a scriptable menu using the default client theme.

| Parameter | Type | Description |
|---|---|---|
| `title` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Primary header text. |
| `subtitle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional secondary header text. |
| `footer` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional footer or hint text. |
| `items` | [object](https://learn.microsoft.com/dotnet/api/system.object)\[\] | List of rows to display. |
| `positionXPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Horizontal menu center position in percent of screen width. |
| `positionYPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Vertical menu center position in percent of screen height. |
| `interactive` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If false, the menu becomes a click-through display panel. |
| `closeOnSelection` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If true, the menu closes on the first click. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Call this with WaitFor to block until the first menu row is clicked.

</details>

</div>

### ShowStyled

<div class="api-card" id="showstyled-string-string-string-object-single-single-boolean-boolean-color-color-color-color-color">
<span id="M:Sansar.Simulation.UIMenu.ShowStyled(System.String,System.String,System.String,System.Object[],System.Single,System.Single,System.Boolean,System.Boolean,Sansar.Color,Sansar.Color,Sansar.Color,Sansar.Color,Sansar.Color)"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void ShowStyled(
    string title,
    string subtitle,
    string footer,
    object[] items,
    float positionXPercent,
    float positionYPercent,
    bool interactive,
    bool closeOnSelection,
    Sansar.Color panelBackgroundColor,
    Sansar.Color panelBorderColor,
    Sansar.Color titleColor,
    Sansar.Color textColor,
    Sansar.Color accentColor
)
```

Show a scriptable menu with caller-provided colors.

| Parameter | Type | Description |
|---|---|---|
| `title` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Primary header text. |
| `subtitle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional secondary header text. |
| `footer` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional footer or hint text. |
| `items` | [object](https://learn.microsoft.com/dotnet/api/system.object)\[\] | List of rows to display. |
| `positionXPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Horizontal menu center position in percent of screen width. |
| `positionYPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Vertical menu center position in percent of screen height. |
| `interactive` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If false, the menu becomes a click-through display panel. |
| `closeOnSelection` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If true, the menu closes on the first click. |
| `panelBackgroundColor` | [Sansar.Color](/scripting/api/sansar/color) | Background color for the menu body. |
| `panelBorderColor` | [Sansar.Color](/scripting/api/sansar/color) | Border color for the menu frame. |
| `titleColor` | [Sansar.Color](/scripting/api/sansar/color) | Title text color. |
| `textColor` | [Sansar.Color](/scripting/api/sansar/color) | Body and row text color. |
| `accentColor` | [Sansar.Color](/scripting/api/sansar/color) | Accent color used for hover and separators. |

<details class="api-remarks"><summary>Remarks</summary>

Call this with WaitFor to block until the first menu row is clicked.

</details>

</div>

<div class="api-card" id="showstyled-string-string-string-object-single-single-boolean-boolean-color-color-color-color-color-action">
<span id="M:Sansar.Simulation.UIMenu.ShowStyled(System.String,System.String,System.String,System.Object[],System.Single,System.Single,System.Boolean,System.Boolean,Sansar.Color,Sansar.Color,Sansar.Color,Sansar.Color,Sansar.Color,System.Action{Sansar.Script.OperationCompleteEvent})"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public void ShowStyled(
    string title,
    string subtitle,
    string footer,
    object[] items,
    float positionXPercent,
    float positionYPercent,
    bool interactive,
    bool closeOnSelection,
    Sansar.Color panelBackgroundColor,
    Sansar.Color panelBorderColor,
    Sansar.Color titleColor,
    Sansar.Color textColor,
    Sansar.Color accentColor,
    Action<Sansar.Script.OperationCompleteEvent> handler
)
```

Show a scriptable menu with caller-provided colors.

| Parameter | Type | Description |
|---|---|---|
| `title` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Primary header text. |
| `subtitle` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional secondary header text. |
| `footer` | [string](https://learn.microsoft.com/dotnet/api/system.string) | Optional footer or hint text. |
| `items` | [object](https://learn.microsoft.com/dotnet/api/system.object)\[\] | List of rows to display. |
| `positionXPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Horizontal menu center position in percent of screen width. |
| `positionYPercent` | [float](https://learn.microsoft.com/dotnet/api/system.single) | Vertical menu center position in percent of screen height. |
| `interactive` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If false, the menu becomes a click-through display panel. |
| `closeOnSelection` | [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | If true, the menu closes on the first click. |
| `panelBackgroundColor` | [Sansar.Color](/scripting/api/sansar/color) | Background color for the menu body. |
| `panelBorderColor` | [Sansar.Color](/scripting/api/sansar/color) | Border color for the menu frame. |
| `titleColor` | [Sansar.Color](/scripting/api/sansar/color) | Title text color. |
| `textColor` | [Sansar.Color](/scripting/api/sansar/color) | Body and row text color. |
| `accentColor` | [Sansar.Color](/scripting/api/sansar/color) | Accent color used for hover and separators. |
| `handler` | [Action&lt;Sansar.Script.OperationCompleteEvent&gt;](https://learn.microsoft.com/dotnet/api/system.action-1) | Handler to be called when the event completes. |

<details class="api-remarks"><summary>Remarks</summary>

Call this with WaitFor to block until the first menu row is clicked.

</details>

</div>

### ToString

<div class="api-card">
<span id="M:Sansar.Simulation.UIMenu.ToString"></span>
<span id="M:Sansar.Simulation.UIMenu.ToString()"></span>
<div class="api-badges"><span class="api-badge api-since">Added in 47.1.1</span></div>

```csharp signature
public override string ToString()
```

A string representation of this object.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — A string representation of this object.

<details class="api-remarks"><summary>Remarks</summary>

The format of this string may change between releases.

</details>

</div>




<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>