# XWUIGameSubtitlePanel

A semi-transparent subtitle/caption bar for spoken dialogue during gameplay, anchored to the top or bottom via the `position` conf_comp option. It renders an optional `speaker` name (when `showSpeaker`) followed by the subtitle `text`, and is shown/hidden by the `data.active` flag. Appearance is tuned with the `fontSize` and `maxLines` conf_comp options (`maxLines` clamps the text via a line-clamp). The runtime API includes `setText(text, speaker?)` to push a new caption (auto-activates) and `hide()` to dismiss it. Use it to display character dialogue, narration, or captions over the game view.

## Basic Usage

Instantiates the subtitle panel in the `#app` element at the default bottom position with `active: true`, showing the speaker "Captain Reyes" and a line of spoken dialogue.

```example
file: examples/BasicUsage.ts
html: examples/BasicUsage.html
title: Basic Usage
description: Creates an XWUIGameSubtitlePanel in the #app container with a speaker and a line of dialogue.
```

## Top Narration

A speaker-less caption pinned to the top of the view at a larger font size for omniscient narration.

```example
file: examples/TopNarration.ts
html: examples/BasicUsage.html
title: Top Narration
description: A top-positioned narration line with showSpeaker off and a larger 20px font size.
```

## Clamped Caption

A long dialogue line clamped to a single line with `maxLines: 1`, truncated with an ellipsis instead of wrapping.

```example
file: examples/ClampedCaption.ts
html: examples/BasicUsage.html
title: Clamped Caption
description: A long caption clamped to one line via maxLines so the overflow ellipsis is visible.
```

```api
```
