# Xui.Core.UI.Layer

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`struct BorderLayer<TView, TChild>`](#api-ce3e0b25f8e8191f)
- [`struct ContentLayer`](#api-57531bb01cd513a7)
- [`class DockLayer`](#api-e8679da581ed061d)
- [`enum DockLayer.Align`](#api-3781d5ed1e7e7eee)
- [`struct DockLayer.Dock2<TView, T1, T2>`](#api-56b04818b1bc20de)
- [`struct DockLayer.Dock3<TView, T1, T2, T3>`](#api-1880954ff33d611b)
- [`struct DockLayer.Dock4<TView, T1, T2, T3, T4>`](#api-17540edbb5b53e2f)
- [`struct DockLayer.Docked<T>`](#api-92bd57da858cb559)
- [`struct FocusBorderLayer<TView, TChild>`](#api-8e6472d2fd714f30)
- [`interface IButtonAction<THost>`](#api-be8a1ac27c42f0be)
- [`interface ILayer<TView>`](#api-ecc071f5097f91b9)
- [`interface ILayerHost`](#api-ce4b7b4baa232941)
- [`class LayerView<TView, TLayer>`](#api-e57d1ddcb15ba513)
- [`struct TextInputLayer`](#api-58aad8df3817bd2a)

<a id="api-ce3e0b25f8e8191f"></a>

## `struct BorderLayer<TView, TChild>`

A layer that draws a background fill, a border stroke, and optional padding around a child layer. Rendering logic is identical to [`Xui.Core.UI.Border`](../xui-core-ui/index.md#api-40ff3aff25d07ab1) but expressed as a composable struct with no heap allocation.

- **`TView`** — The host type. Must implement [`Xui.Core.UI.Layer.ILayerHost`](../xui-core-ui-layer/index.md#api-ce4b7b4baa232941).

- **`TChild`** — The inner layer that receives the inset rectangle.

```csharp
public struct BorderLayer<TView, TChild> : ILayer<TView> where TView : ILayerHost where TChild : struct, ILayer<TView>
{
    public TChild Child;
    public Frame BorderThickness;
    public CornerRadius CornerRadius;
    public Color BackgroundColor;
    public Color BorderColor;
    public Frame Padding;
    public Size Measure(TView view, Size availableSize, IMeasureContext context);
    public void Arrange(TView view, Rect rect, IMeasureContext context);
    public void Render(TView view, IContext context);
    public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
    public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(TView view, ref KeyEventRef e);
    public void OnChar(TView view, ref KeyEventRef e);
    public void OnFocus(TView view);
    public void OnBlur(TView view);
}
```

<a id="api-4315bcb321458dd3"></a>

### [`void BorderLayer<TView, TChild>.Animate(TView view, TimeSpan previousTime, TimeSpan currentTime)`](#api-4315bcb321458dd3)


```csharp
public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-72938aafac7bb212"></a>

### [`void BorderLayer<TView, TChild>.Arrange(TView view, Rect rect, IMeasureContext context)`](#api-72938aafac7bb212)


```csharp
public void Arrange(TView view, Rect rect, IMeasureContext context);
```

Finalises position and size within `rect`.

<a id="api-6517f845848acb10"></a>

### [`Color BorderLayer<TView, TChild>.BackgroundColor`](#api-6517f845848acb10)


```csharp
public Color BackgroundColor;
```

Background fill color.

<a id="api-d6517a3eaaf27099"></a>

### [`Color BorderLayer<TView, TChild>.BorderColor`](#api-d6517a3eaaf27099)


```csharp
public Color BorderColor;
```

Border stroke color.

<a id="api-13d80ff29eefd1a4"></a>

### [`Frame BorderLayer<TView, TChild>.BorderThickness`](#api-13d80ff29eefd1a4)


```csharp
public Frame BorderThickness;
```

Per-side border thickness.

<a id="api-01c85bb5c2a72ba8"></a>

### [`TChild BorderLayer<TView, TChild>.Child`](#api-01c85bb5c2a72ba8)


```csharp
public TChild Child;
```

The inner layer rendered inside the border and padding.

<a id="api-855d4a4a195c6aba"></a>

### [`CornerRadius BorderLayer<TView, TChild>.CornerRadius`](#api-855d4a4a195c6aba)


```csharp
public CornerRadius CornerRadius;
```

Corner radius for the background fill and border stroke.

<a id="api-2bec35dcfc16fb8e"></a>

### [`Size BorderLayer<TView, TChild>.Measure(TView view, Size availableSize, IMeasureContext context)`](#api-2bec35dcfc16fb8e)


```csharp
public Size Measure(TView view, Size availableSize, IMeasureContext context);
```

Returns the desired border-edge size given the available space.

<a id="api-276367e5c1b1be5d"></a>

### [`void BorderLayer<TView, TChild>.OnBlur(TView view)`](#api-276367e5c1b1be5d)


```csharp
public void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-0e8d7cc717e61f94"></a>

### [`void BorderLayer<TView, TChild>.OnChar(TView view, ref KeyEventRef e)`](#api-0e8d7cc717e61f94)


```csharp
public void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-cc394351109be56e"></a>

### [`void BorderLayer<TView, TChild>.OnFocus(TView view)`](#api-cc394351109be56e)


```csharp
public void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-7d374f809527cf06"></a>

### [`void BorderLayer<TView, TChild>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-7d374f809527cf06)


```csharp
public void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-389a41f6e0f8f519"></a>

### [`void BorderLayer<TView, TChild>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-389a41f6e0f8f519)


```csharp
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-6eab9028c63a5e82"></a>

### [`Frame BorderLayer<TView, TChild>.Padding`](#api-6eab9028c63a5e82)


```csharp
public Frame Padding;
```

Padding between the border edge and the child layer.

<a id="api-2762c7520301ac6d"></a>

### [`void BorderLayer<TView, TChild>.Render(TView view, IContext context)`](#api-2762c7520301ac6d)


```csharp
public void Render(TView view, IContext context);
```

Draws content. Called after Arrange.


<a id="api-57531bb01cd513a7"></a>

## `struct ContentLayer`

A terminal layer that delegates layout and rendering to a child [`Xui.Core.UI.View`](../xui-core-ui/index.md#api-0389f82d4babca03), bridging the layer tree back into the standard view hierarchy. Input routing is left to the [`Xui.Core.UI.Input.EventRouter`](../xui-core-ui-input/index.md#api-bbb1bb65c4162ada) which hit-tests the child view directly, so all input methods here are intentional no-ops.

```csharp
public struct ContentLayer : ILayer<View>
{
    public View? Child;
    public Size Measure(View view, Size availableSize, IMeasureContext context);
    public void Arrange(View view, Rect rect, IMeasureContext context);
    public void Render(View view, IContext context);
    public void Animate(View view, TimeSpan previousTime, TimeSpan currentTime);
    public void OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(View view, ref KeyEventRef e);
    public void OnChar(View view, ref KeyEventRef e);
    public void OnFocus(View view);
    public void OnBlur(View view);
}
```

<a id="api-39efa71014ff1a01"></a>

### [`void ContentLayer.Animate(View view, TimeSpan previousTime, TimeSpan currentTime)`](#api-39efa71014ff1a01)


```csharp
public void Animate(View view, TimeSpan previousTime, TimeSpan currentTime);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-8951641747f632a6"></a>

### [`void ContentLayer.Arrange(View view, Rect rect, IMeasureContext context)`](#api-8951641747f632a6)


```csharp
public void Arrange(View view, Rect rect, IMeasureContext context);
```

Finalises position and size within `rect`.

<a id="api-14d356e9fb68c802"></a>

### [`View? ContentLayer.Child`](#api-14d356e9fb68c802)


```csharp
public View? Child;
```

The child view to measure, arrange, and render.

<a id="api-5956405df8056d9e"></a>

### [`Size ContentLayer.Measure(View view, Size availableSize, IMeasureContext context)`](#api-5956405df8056d9e)


```csharp
public Size Measure(View view, Size availableSize, IMeasureContext context);
```

Returns the desired border-edge size given the available space.

<a id="api-8f9344473d74dbe0"></a>

### [`void ContentLayer.OnBlur(View view)`](#api-8f9344473d74dbe0)


```csharp
public void OnBlur(View view);
```

Called when the host view loses keyboard focus.

<a id="api-8f4577f237db5c5e"></a>

### [`void ContentLayer.OnChar(View view, ref KeyEventRef e)`](#api-8f4577f237db5c5e)


```csharp
public void OnChar(View view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-4edd5b5b0f02f0ce"></a>

### [`void ContentLayer.OnFocus(View view)`](#api-4edd5b5b0f02f0ce)


```csharp
public void OnFocus(View view);
```

Called when the host view gains keyboard focus.

<a id="api-c2c7eb85749b8867"></a>

### [`void ContentLayer.OnKeyDown(View view, ref KeyEventRef e)`](#api-c2c7eb85749b8867)


```csharp
public void OnKeyDown(View view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-7e07e7e64dd40e53"></a>

### [`void ContentLayer.OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase)`](#api-7e07e7e64dd40e53)


```csharp
public void OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-4197e13efc36f1c0"></a>

### [`void ContentLayer.Render(View view, IContext context)`](#api-4197e13efc36f1c0)


```csharp
public void Render(View view, IContext context);
```

Draws content. Called after Arrange.


<a id="api-e8679da581ed061d"></a>

## `class DockLayer`

Container for dock layout types. Usage: `DockLayer.Dock3<View, StepButton, NumberInputLayer, StepButton>`

```csharp
public static class DockLayer
{
    public enum Align
    {
        Left,
        Stretch,
        Right
    }

    public struct Docked<T>
        where T : struct
    {
        public Align Align;
        public T Child;
    }

    public struct Dock2<TView, T1, T2> : ILayer<TView> where TView : ILayerHost where T1 : struct, ILayer<TView> where T2 : struct, ILayer<TView>
    {
        public Docked<T1> Child1;
        public Docked<T2> Child2;
        public Size Measure(TView view, Size available, IMeasureContext ctx);
        public void Arrange(TView view, Rect rect, IMeasureContext ctx);
        public void Render(TView view, IContext ctx);
        public void Animate(TView view, TimeSpan p, TimeSpan c);
        public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
        public void OnKeyDown(TView view, ref KeyEventRef e);
        public void OnChar(TView view, ref KeyEventRef e);
        public void OnFocus(TView view);
        public void OnBlur(TView view);
    }

    public struct Dock3<TView, T1, T2, T3> : ILayer<TView> where TView : ILayerHost where T1 : struct, ILayer<TView> where T2 : struct, ILayer<TView> where T3 : struct, ILayer<TView>
    {
        public Docked<T1> Child1;
        public Docked<T2> Child2;
        public Docked<T3> Child3;
        public Size Measure(TView view, Size available, IMeasureContext ctx);
        public void Arrange(TView view, Rect rect, IMeasureContext ctx);
        public void Render(TView view, IContext ctx);
        public void Animate(TView view, TimeSpan p, TimeSpan c);
        public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
        public void OnKeyDown(TView view, ref KeyEventRef e);
        public void OnChar(TView view, ref KeyEventRef e);
        public void OnFocus(TView view);
        public void OnBlur(TView view);
    }

    public struct Dock4<TView, T1, T2, T3, T4> : ILayer<TView> where TView : ILayerHost where T1 : struct, ILayer<TView> where T2 : struct, ILayer<TView> where T3 : struct, ILayer<TView> where T4 : struct, ILayer<TView>
    {
        public Docked<T1> Child1;
        public Docked<T2> Child2;
        public Docked<T3> Child3;
        public Docked<T4> Child4;
        public Size Measure(TView view, Size available, IMeasureContext ctx);
        public void Arrange(TView view, Rect rect, IMeasureContext ctx);
        public void Render(TView view, IContext ctx);
        public void Animate(TView view, TimeSpan p, TimeSpan c);
        public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
        public void OnKeyDown(TView view, ref KeyEventRef e);
        public void OnChar(TView view, ref KeyEventRef e);
        public void OnFocus(TView view);
        public void OnBlur(TView view);
    }
}
```


<a id="api-3781d5ed1e7e7eee"></a>

## `enum DockLayer.Align`

Determines how docked children are aligned on the cross axis.

```csharp
public enum Align
{
    Left,
    Stretch,
    Right
}
```

<a id="api-eff29da765d95c3d"></a>

### [`Align.Left`](#api-eff29da765d95c3d)


```csharp
Left
```

Align to the left edge.

<a id="api-8863fa83571535f9"></a>

### [`Align.Right`](#api-8863fa83571535f9)


```csharp
Right
```

Align to the right edge.

<a id="api-c3aeb2538643ad0f"></a>

### [`Align.Stretch`](#api-c3aeb2538643ad0f)


```csharp
Stretch
```

Stretch to fill the available cross-axis space.


<a id="api-56b04818b1bc20de"></a>

## `struct DockLayer.Dock2<TView, T1, T2>`

Two-slot dock layout.

```csharp
public struct Dock2<TView, T1, T2> : ILayer<TView> where TView : ILayerHost where T1 : struct, ILayer<TView> where T2 : struct, ILayer<TView>
{
    public Docked<T1> Child1;
    public Docked<T2> Child2;
    public Size Measure(TView view, Size available, IMeasureContext ctx);
    public void Arrange(TView view, Rect rect, IMeasureContext ctx);
    public void Render(TView view, IContext ctx);
    public void Animate(TView view, TimeSpan p, TimeSpan c);
    public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(TView view, ref KeyEventRef e);
    public void OnChar(TView view, ref KeyEventRef e);
    public void OnFocus(TView view);
    public void OnBlur(TView view);
}
```

<a id="api-78fd08d9ddfea7e1"></a>

### [`void Dock2<TView, T1, T2>.Animate(TView view, TimeSpan p, TimeSpan c)`](#api-78fd08d9ddfea7e1)


```csharp
public void Animate(TView view, TimeSpan p, TimeSpan c);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-1ba4eb563d0ad95b"></a>

### [`void Dock2<TView, T1, T2>.Arrange(TView view, Rect rect, IMeasureContext ctx)`](#api-1ba4eb563d0ad95b)


```csharp
public void Arrange(TView view, Rect rect, IMeasureContext ctx);
```

Finalises position and size within `rect`.

<a id="api-d704c75a01d10d64"></a>

### [`Docked<T1> Dock2<TView, T1, T2>.Child1`](#api-d704c75a01d10d64)


```csharp
public Docked<T1> Child1;
```

The first docked child.

<a id="api-c6edba8d1fc02aad"></a>

### [`Docked<T2> Dock2<TView, T1, T2>.Child2`](#api-c6edba8d1fc02aad)


```csharp
public Docked<T2> Child2;
```

The second docked child.

<a id="api-57ae1a34ceda285f"></a>

### [`Size Dock2<TView, T1, T2>.Measure(TView view, Size available, IMeasureContext ctx)`](#api-57ae1a34ceda285f)


```csharp
public Size Measure(TView view, Size available, IMeasureContext ctx);
```

Returns the desired border-edge size given the available space.

<a id="api-cc221180d5f19684"></a>

### [`void Dock2<TView, T1, T2>.OnBlur(TView view)`](#api-cc221180d5f19684)


```csharp
public void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-9f9005cdac43fe3f"></a>

### [`void Dock2<TView, T1, T2>.OnChar(TView view, ref KeyEventRef e)`](#api-9f9005cdac43fe3f)


```csharp
public void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-fb1078a0ea9d43bd"></a>

### [`void Dock2<TView, T1, T2>.OnFocus(TView view)`](#api-fb1078a0ea9d43bd)


```csharp
public void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-1647a1c9739c8f8b"></a>

### [`void Dock2<TView, T1, T2>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-1647a1c9739c8f8b)


```csharp
public void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-fa6df22c237e3a5e"></a>

### [`void Dock2<TView, T1, T2>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-fa6df22c237e3a5e)


```csharp
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-a25df8dc7ec2df67"></a>

### [`void Dock2<TView, T1, T2>.Render(TView view, IContext ctx)`](#api-a25df8dc7ec2df67)


```csharp
public void Render(TView view, IContext ctx);
```

Draws content. Called after Arrange.


<a id="api-1880954ff33d611b"></a>

## `struct DockLayer.Dock3<TView, T1, T2, T3>`

Three-slot dock layout. Typical usage: Left button | Stretch content | Right button.

```csharp
public struct Dock3<TView, T1, T2, T3> : ILayer<TView> where TView : ILayerHost where T1 : struct, ILayer<TView> where T2 : struct, ILayer<TView> where T3 : struct, ILayer<TView>
{
    public Docked<T1> Child1;
    public Docked<T2> Child2;
    public Docked<T3> Child3;
    public Size Measure(TView view, Size available, IMeasureContext ctx);
    public void Arrange(TView view, Rect rect, IMeasureContext ctx);
    public void Render(TView view, IContext ctx);
    public void Animate(TView view, TimeSpan p, TimeSpan c);
    public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(TView view, ref KeyEventRef e);
    public void OnChar(TView view, ref KeyEventRef e);
    public void OnFocus(TView view);
    public void OnBlur(TView view);
}
```

<a id="api-c7895add6a5ac247"></a>

### [`void Dock3<TView, T1, T2, T3>.Animate(TView view, TimeSpan p, TimeSpan c)`](#api-c7895add6a5ac247)


```csharp
public void Animate(TView view, TimeSpan p, TimeSpan c);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-75bb269dd6decc51"></a>

### [`void Dock3<TView, T1, T2, T3>.Arrange(TView view, Rect rect, IMeasureContext ctx)`](#api-75bb269dd6decc51)


```csharp
public void Arrange(TView view, Rect rect, IMeasureContext ctx);
```

Finalises position and size within `rect`.

<a id="api-76a4825420869db8"></a>

### [`Docked<T1> Dock3<TView, T1, T2, T3>.Child1`](#api-76a4825420869db8)


```csharp
public Docked<T1> Child1;
```

The first docked child.

<a id="api-a8210384ed5ca6e2"></a>

### [`Docked<T2> Dock3<TView, T1, T2, T3>.Child2`](#api-a8210384ed5ca6e2)


```csharp
public Docked<T2> Child2;
```

The second docked child.

<a id="api-295e4b557a2309a1"></a>

### [`Docked<T3> Dock3<TView, T1, T2, T3>.Child3`](#api-295e4b557a2309a1)


```csharp
public Docked<T3> Child3;
```

The third docked child.

<a id="api-b89e5e71e2d1c517"></a>

### [`Size Dock3<TView, T1, T2, T3>.Measure(TView view, Size available, IMeasureContext ctx)`](#api-b89e5e71e2d1c517)


```csharp
public Size Measure(TView view, Size available, IMeasureContext ctx);
```

Returns the desired border-edge size given the available space.

<a id="api-985c7bed7bbedc9e"></a>

### [`void Dock3<TView, T1, T2, T3>.OnBlur(TView view)`](#api-985c7bed7bbedc9e)


```csharp
public void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-c2241c56988b7969"></a>

### [`void Dock3<TView, T1, T2, T3>.OnChar(TView view, ref KeyEventRef e)`](#api-c2241c56988b7969)


```csharp
public void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-3b419f7fece4cb0d"></a>

### [`void Dock3<TView, T1, T2, T3>.OnFocus(TView view)`](#api-3b419f7fece4cb0d)


```csharp
public void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-0929137189186460"></a>

### [`void Dock3<TView, T1, T2, T3>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-0929137189186460)


```csharp
public void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-1a54eeaeafac3e08"></a>

### [`void Dock3<TView, T1, T2, T3>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-1a54eeaeafac3e08)


```csharp
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-3043d0cd28079708"></a>

### [`void Dock3<TView, T1, T2, T3>.Render(TView view, IContext ctx)`](#api-3043d0cd28079708)


```csharp
public void Render(TView view, IContext ctx);
```

Draws content. Called after Arrange.


<a id="api-17540edbb5b53e2f"></a>

## `struct DockLayer.Dock4<TView, T1, T2, T3, T4>`

Four-slot dock layout.

```csharp
public struct Dock4<TView, T1, T2, T3, T4> : ILayer<TView> where TView : ILayerHost where T1 : struct, ILayer<TView> where T2 : struct, ILayer<TView> where T3 : struct, ILayer<TView> where T4 : struct, ILayer<TView>
{
    public Docked<T1> Child1;
    public Docked<T2> Child2;
    public Docked<T3> Child3;
    public Docked<T4> Child4;
    public Size Measure(TView view, Size available, IMeasureContext ctx);
    public void Arrange(TView view, Rect rect, IMeasureContext ctx);
    public void Render(TView view, IContext ctx);
    public void Animate(TView view, TimeSpan p, TimeSpan c);
    public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(TView view, ref KeyEventRef e);
    public void OnChar(TView view, ref KeyEventRef e);
    public void OnFocus(TView view);
    public void OnBlur(TView view);
}
```

<a id="api-d7ca169562b5dc96"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.Animate(TView view, TimeSpan p, TimeSpan c)`](#api-d7ca169562b5dc96)


```csharp
public void Animate(TView view, TimeSpan p, TimeSpan c);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-e1d16481f5341c91"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.Arrange(TView view, Rect rect, IMeasureContext ctx)`](#api-e1d16481f5341c91)


```csharp
public void Arrange(TView view, Rect rect, IMeasureContext ctx);
```

Finalises position and size within `rect`.

<a id="api-3086a8fb4056c0c8"></a>

### [`Docked<T1> Dock4<TView, T1, T2, T3, T4>.Child1`](#api-3086a8fb4056c0c8)


```csharp
public Docked<T1> Child1;
```

The first docked child.

<a id="api-7ec314aad667ea53"></a>

### [`Docked<T2> Dock4<TView, T1, T2, T3, T4>.Child2`](#api-7ec314aad667ea53)


```csharp
public Docked<T2> Child2;
```

The second docked child.

<a id="api-4733c7af166b42f6"></a>

### [`Docked<T3> Dock4<TView, T1, T2, T3, T4>.Child3`](#api-4733c7af166b42f6)


```csharp
public Docked<T3> Child3;
```

The third docked child.

<a id="api-e1b28de48855413a"></a>

### [`Docked<T4> Dock4<TView, T1, T2, T3, T4>.Child4`](#api-e1b28de48855413a)


```csharp
public Docked<T4> Child4;
```

The fourth docked child.

<a id="api-5c96b32d1137dfd4"></a>

### [`Size Dock4<TView, T1, T2, T3, T4>.Measure(TView view, Size available, IMeasureContext ctx)`](#api-5c96b32d1137dfd4)


```csharp
public Size Measure(TView view, Size available, IMeasureContext ctx);
```

Returns the desired border-edge size given the available space.

<a id="api-7a90ae0b799760cb"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.OnBlur(TView view)`](#api-7a90ae0b799760cb)


```csharp
public void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-40f204456bd92c95"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.OnChar(TView view, ref KeyEventRef e)`](#api-40f204456bd92c95)


```csharp
public void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-de118f9d90824669"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.OnFocus(TView view)`](#api-de118f9d90824669)


```csharp
public void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-f4083eeba0ff15f3"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-f4083eeba0ff15f3)


```csharp
public void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-b384b671bc6e5c39"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-b384b671bc6e5c39)


```csharp
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-693ea162d4e0da82"></a>

### [`void Dock4<TView, T1, T2, T3, T4>.Render(TView view, IContext ctx)`](#api-693ea162d4e0da82)


```csharp
public void Render(TView view, IContext ctx);
```

Draws content. Called after Arrange.


<a id="api-92bd57da858cb559"></a>

## `struct DockLayer.Docked<T>`

Wraps a dockable child with its alignment setting.

```csharp
public struct Docked<T>
    where T : struct
{
    public Align Align;
    public T Child;
}
```

<a id="api-1023290f861ae2e0"></a>

### [`Align Docked<T>.Align`](#api-1023290f861ae2e0)


```csharp
public Align Align;
```

The cross-axis alignment for the docked child.

<a id="api-7fa4d18cdf952c02"></a>

### [`T Docked<T>.Child`](#api-7fa4d18cdf952c02)


```csharp
public T Child;
```

The docked child layer.


<a id="api-8e6472d2fd714f30"></a>

## `struct FocusBorderLayer<TView, TChild>`

A [`Xui.Core.UI.Layer.BorderLayer`2`](../xui-core-ui-layer/index.md#api-ce3e0b25f8e8191f) variant that switches border color when the host view has keyboard focus. All layout and rendering is delegated to an inner [`Xui.Core.UI.Layer.BorderLayer`2`](../xui-core-ui-layer/index.md#api-ce3e0b25f8e8191f); only [`Xui.Core.UI.Layer.FocusBorderLayer`2.Render(`0,Xui.Core.Canvas.IContext)`](../xui-core-ui-layer/index.md#api-3272297fd204e9a3) swaps the color, and [`Xui.Core.UI.Layer.FocusBorderLayer`2.OnFocus(`0)`](../xui-core-ui-layer/index.md#api-ffce2fbdfb6d64c5) / [`Xui.Core.UI.Layer.FocusBorderLayer`2.OnBlur(`0)`](../xui-core-ui-layer/index.md#api-11bec3e97972e597) request a repaint.

```csharp
public struct FocusBorderLayer<TView, TChild> : ILayer<TView> where TView : ILayerHost where TChild : struct, ILayer<TView>
{
    public BorderLayer<TView, TChild> Border;
    public Color FocusedBorderColor;
    public Frame BorderThickness { get; set; }
    public CornerRadius CornerRadius { get; set; }
    public Color BackgroundColor { get; set; }
    public Color BorderColor { get; set; }
    public Frame Padding { get; set; }

    public Size Measure(TView view, Size availableSize, IMeasureContext context);
    public void Arrange(TView view, Rect rect, IMeasureContext context);
    public void Render(TView view, IContext context);
    public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
    public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(TView view, ref KeyEventRef e);
    public void OnChar(TView view, ref KeyEventRef e);
    public void OnFocus(TView view);
    public void OnBlur(TView view);
}
```

<a id="api-3aba69b0ea7c9d96"></a>

### [`void FocusBorderLayer<TView, TChild>.Animate(TView view, TimeSpan previousTime, TimeSpan currentTime)`](#api-3aba69b0ea7c9d96)


```csharp
public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-826ae92a1fa2da99"></a>

### [`void FocusBorderLayer<TView, TChild>.Arrange(TView view, Rect rect, IMeasureContext context)`](#api-826ae92a1fa2da99)


```csharp
public void Arrange(TView view, Rect rect, IMeasureContext context);
```

Finalises position and size within `rect`.

<a id="api-a30324af5c1d8c2a"></a>

### [`Color FocusBorderLayer<TView, TChild>.BackgroundColor`](#api-a30324af5c1d8c2a)


```csharp
public Color BackgroundColor { get; set; }
```

Background fill color.

<a id="api-f1a05764129381f4"></a>

### [`BorderLayer<TView, TChild> FocusBorderLayer<TView, TChild>.Border`](#api-f1a05764129381f4)


```csharp
public BorderLayer<TView, TChild> Border;
```

The inner border layer that owns all geometry and rendering.

<a id="api-12b8507e2f2abc15"></a>

### [`Color FocusBorderLayer<TView, TChild>.BorderColor`](#api-12b8507e2f2abc15)


```csharp
public Color BorderColor { get; set; }
```

Border stroke color.

<a id="api-dee51e83351a2ddf"></a>

### [`Frame FocusBorderLayer<TView, TChild>.BorderThickness`](#api-dee51e83351a2ddf)


```csharp
public Frame BorderThickness { get; set; }
```

Per-side border thickness.

<a id="api-561cfa08715f7f2e"></a>

### [`CornerRadius FocusBorderLayer<TView, TChild>.CornerRadius`](#api-561cfa08715f7f2e)


```csharp
public CornerRadius CornerRadius { get; set; }
```

Corner radius for the background fill and border stroke.

<a id="api-4268ac224135f297"></a>

### [`Color FocusBorderLayer<TView, TChild>.FocusedBorderColor`](#api-4268ac224135f297)


```csharp
public Color FocusedBorderColor;
```

Border color used when the host view has keyboard focus.

<a id="api-ea11a0b3338775fc"></a>

### [`Size FocusBorderLayer<TView, TChild>.Measure(TView view, Size availableSize, IMeasureContext context)`](#api-ea11a0b3338775fc)


```csharp
public Size Measure(TView view, Size availableSize, IMeasureContext context);
```

Returns the desired border-edge size given the available space.

<a id="api-11bec3e97972e597"></a>

### [`void FocusBorderLayer<TView, TChild>.OnBlur(TView view)`](#api-11bec3e97972e597)


```csharp
public void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-8fbb07f7a8b05d46"></a>

### [`void FocusBorderLayer<TView, TChild>.OnChar(TView view, ref KeyEventRef e)`](#api-8fbb07f7a8b05d46)


```csharp
public void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-ffce2fbdfb6d64c5"></a>

### [`void FocusBorderLayer<TView, TChild>.OnFocus(TView view)`](#api-ffce2fbdfb6d64c5)


```csharp
public void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-39df4262ae3e2607"></a>

### [`void FocusBorderLayer<TView, TChild>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-39df4262ae3e2607)


```csharp
public void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-d5dc6add59da01f5"></a>

### [`void FocusBorderLayer<TView, TChild>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-d5dc6add59da01f5)


```csharp
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-5d5a136a9c774c0b"></a>

### [`Frame FocusBorderLayer<TView, TChild>.Padding`](#api-5d5a136a9c774c0b)


```csharp
public Frame Padding { get; set; }
```

Padding between the border edge and the child layer.

<a id="api-3272297fd204e9a3"></a>

### [`void FocusBorderLayer<TView, TChild>.Render(TView view, IContext context)`](#api-3272297fd204e9a3)


```csharp
public void Render(TView view, IContext context);
```

Draws content. Called after Arrange.


<a id="api-be8a1ac27c42f0be"></a>

## `interface IButtonAction<THost>`

Zero-allocation click handler for button layers. Implement as a private nested struct inside the owning view so [`Xui.Core.UI.Layer.IButtonAction`1.Execute(`0)`](../xui-core-ui-layer/index.md#api-bdc7b4028a672833) receives the fully-typed host and can call any method on it without closures.

```csharp
public interface IButtonAction<in THost>
    where THost : ILayerHost
{
    void Execute(THost host);
}
```

<a id="api-bdc7b4028a672833"></a>

### [`void IButtonAction<THost>.Execute(THost host)`](#api-bdc7b4028a672833)


```csharp
void Execute(THost host);
```

Executes the button action on the given host view.

- **`host`** — The host view that owns the button.


<a id="api-ecc071f5097f91b9"></a>

## `interface ILayer<TView>`

A composable struct that handles a portion of a view&#39;s layout, rendering, and input. Layers are value types composed at compile time — no virtual dispatch, no allocations. The host `TView` provides resources and invalidation callbacks; the layer carries its own state and logic.

- **`TView`** — The host type for this layer. Must implement [`Xui.Core.UI.Layer.ILayerHost`](../xui-core-ui-layer/index.md#api-ce4b7b4baa232941). Almost always [`Xui.Core.UI.View`](../xui-core-ui/index.md#api-0389f82d4babca03); use a more derived type only when the layer needs access to host-specific APIs beyond the [`Xui.Core.UI.Layer.ILayerHost`](../xui-core-ui-layer/index.md#api-ce4b7b4baa232941) contract.

```csharp
public interface ILayer<in TView>
    where TView : ILayerHost
{
    void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
    Size Measure(TView view, Size availableSize, IMeasureContext context);
    void Arrange(TView view, Rect rect, IMeasureContext context);
    void Render(TView view, IContext context);
    void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
    void OnKeyDown(TView view, ref KeyEventRef e);
    void OnChar(TView view, ref KeyEventRef e);
    void OnFocus(TView view);
    void OnBlur(TView view);
}
```

<a id="api-f129357730334797"></a>

### [`void ILayer<TView>.Animate(TView view, TimeSpan previousTime, TimeSpan currentTime)`](#api-f129357730334797)


```csharp
void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-919a779fb401a971"></a>

### [`void ILayer<TView>.Arrange(TView view, Rect rect, IMeasureContext context)`](#api-919a779fb401a971)


```csharp
void Arrange(TView view, Rect rect, IMeasureContext context);
```

Finalises position and size within `rect`.

<a id="api-13cc0bb851149204"></a>

### [`Size ILayer<TView>.Measure(TView view, Size availableSize, IMeasureContext context)`](#api-13cc0bb851149204)


```csharp
Size Measure(TView view, Size availableSize, IMeasureContext context);
```

Returns the desired border-edge size given the available space.

<a id="api-6d3fb5577e7e5d61"></a>

### [`void ILayer<TView>.OnBlur(TView view)`](#api-6d3fb5577e7e5d61)


```csharp
void OnBlur(TView view);
```

Called when the host view loses keyboard focus.

<a id="api-1a931efcfa4d54d8"></a>

### [`void ILayer<TView>.OnChar(TView view, ref KeyEventRef e)`](#api-1a931efcfa4d54d8)


```csharp
void OnChar(TView view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-81faf9f8fd387894"></a>

### [`void ILayer<TView>.OnFocus(TView view)`](#api-81faf9f8fd387894)


```csharp
void OnFocus(TView view);
```

Called when the host view gains keyboard focus.

<a id="api-fb776cbbdd689a76"></a>

### [`void ILayer<TView>.OnKeyDown(TView view, ref KeyEventRef e)`](#api-fb776cbbdd689a76)


```csharp
void OnKeyDown(TView view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-edb0fbcef83d0a14"></a>

### [`void ILayer<TView>.OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase)`](#api-edb0fbcef83d0a14)


```csharp
void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-ac29292363ea6f17"></a>

### [`void ILayer<TView>.Render(TView view, IContext context)`](#api-ac29292363ea6f17)


```csharp
void Render(TView view, IContext context);
```

Draws content. Called after Arrange.


<a id="api-ce4b7b4baa232941"></a>

## `interface ILayerHost`

The contract a host view must satisfy to be used with [`Xui.Core.UI.Layer.ILayer`1`](../xui-core-ui-layer/index.md#api-ecc071f5097f91b9). Provides the invalidation, focus, pointer-capture, and service-resolution APIs that layers call on their host during layout, rendering, and input handling.

```csharp
public interface ILayerHost : IServiceProvider
{
    Rect Frame { get; }

    bool IsFocused { get; }

    bool Focus();
    void InvalidateRender();
    void InvalidateMeasure();
    void RequestAnimationFrame();
    void CapturePointer(int pointerId, IPointerGesture? gesture = null);
    void ReleasePointer(int pointerId);
}
```

<a id="api-bbf640e09062d91a"></a>

### [`void ILayerHost.CapturePointer(int pointerId, IPointerGesture? gesture = null)`](#api-bbf640e09062d91a)


```csharp
void CapturePointer(int pointerId, IPointerGesture? gesture = null);
```

Routes all subsequent pointer events for `pointerId` to this view.

- **`pointerId`** — The platform-assigned pointer identifier.

- **`gesture`** — Optional gesture marker (see [`Xui.Core.UI.Input.PointerGestures`](../xui-core-ui-input/index.md#api-568fac9d6264f67f)) so ancestor containers can negotiate handover.

<a id="api-0749b18061c8da3f"></a>

### [`bool ILayerHost.Focus()`](#api-0749b18061c8da3f)


```csharp
bool Focus();
```

Requests keyboard focus for the host view. Returns true if focus was granted.

<a id="api-648be81028ae12a2"></a>

### [`Rect ILayerHost.Frame`](#api-648be81028ae12a2)


```csharp
Rect Frame { get; }
```

The arranged frame of the host view, in parent-local coordinates.

<a id="api-8a3e42c182c6baae"></a>

### [`void ILayerHost.InvalidateMeasure()`](#api-8a3e42c182c6baae)


```csharp
void InvalidateMeasure();
```

Marks the view as needing re-measure (and re-layout).

<a id="api-728f8f968c66d635"></a>

### [`void ILayerHost.InvalidateRender()`](#api-728f8f968c66d635)


```csharp
void InvalidateRender();
```

Marks the view as needing re-render.

<a id="api-1c61da330dc9ceaf"></a>

### [`bool ILayerHost.IsFocused`](#api-1c61da330dc9ceaf)


```csharp
bool IsFocused { get; }
```

Whether the host view currently holds keyboard focus.

<a id="api-d0e8aeaef0f05e54"></a>

### [`void ILayerHost.ReleasePointer(int pointerId)`](#api-d0e8aeaef0f05e54)


```csharp
void ReleasePointer(int pointerId);
```

Releases a previously captured pointer.

<a id="api-6c015c1c1df9dfb5"></a>

### [`void ILayerHost.RequestAnimationFrame()`](#api-6c015c1c1df9dfb5)


```csharp
void RequestAnimationFrame();
```

Schedules an animation frame callback via `AnimateCore`.


<a id="api-e57d1ddcb15ba513"></a>

## `class LayerView<TView, TLayer>`

A [`Xui.Core.UI.View`](../xui-core-ui/index.md#api-0389f82d4babca03) that owns a single `TLayer` struct and delegates every layout, rendering, and input override to it, passing itself as the fully-typed `TView` host to every layer method. 

Because the compiler resolves `TLayer` statically, all delegation is devirtualised and inlined by the JIT — zero overhead compared to writing the overrides by hand.



**Child views:** This class is a leaf by default (Count = 0). Subclasses that host child [`Xui.Core.UI.View`](../xui-core-ui/index.md#api-0389f82d4babca03) instances should override [`Xui.Core.UI.View.Count`](../xui-core-ui/index.md#api-da755a65e8a8dc05) and [`Xui.Core.UI.View.Item(System.Int32)`](../xui-core-ui/index.md#api-026ce0d6499bb0bb), and manage attachment via [`Xui.Core.UI.View.SetProtectedChild``1(``0@,``0)`](../xui-core-ui/index.md#api-427acb85419238ae). Use [`Xui.Core.UI.Layer.ContentLayer`](../xui-core-ui-layer/index.md#api-57531bb01cd513a7) to bridge those views back into the layer tree.

- **`TView`** — The concrete view subclass. Must be the class that inherits this. Pass [`Xui.Core.UI.View`](../xui-core-ui/index.md#api-0389f82d4babca03) when no specific host type is needed.

- **`TLayer`** — The layer struct type.

```csharp
public class LayerView<TView, TLayer> : View where TView : View where TLayer : struct, ILayer<TView>
{
    protected TLayer Layer;
    protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime);
    protected override Size MeasureCore(Size availableSize, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
    public override void OnKeyDown(ref KeyEventRef e);
    public override void OnChar(ref KeyEventRef e);
    protected internal override void OnFocus();
    protected internal override void OnBlur();
}
```

<a id="api-9ff16f406cd5854d"></a>

### [`void LayerView<TView, TLayer>.AnimateCore(TimeSpan previousTime, TimeSpan currentTime)`](#api-9ff16f406cd5854d)


```csharp
protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime);
```

Override to animate this view and its children.

<a id="api-7578e263694d3154"></a>

### [`void LayerView<TView, TLayer>.ArrangeCore(Rect rect, IMeasureContext context)`](#api-7578e263694d3154)


```csharp
protected override void ArrangeCore(Rect rect, IMeasureContext context);
```

Override to arrange children within this view&#39;s final frame.

<a id="api-11b02e740f32e868"></a>

### [`TLayer LayerView<TView, TLayer>.Layer`](#api-11b02e740f32e868)


```csharp
protected TLayer Layer;
```

The layer struct that owns all layout and rendering logic for this view.

<a id="api-824acc91333768e3"></a>

### [`Size LayerView<TView, TLayer>.MeasureCore(Size availableSize, IMeasureContext context)`](#api-824acc91333768e3)


```csharp
protected override Size MeasureCore(Size availableSize, IMeasureContext context);
```

Override to compute the desired border-edge size.

<a id="api-267f40909aaac975"></a>

### [`void LayerView<TView, TLayer>.OnBlur()`](#api-267f40909aaac975)


```csharp
protected internal override void OnBlur();
```

Called when this view loses keyboard focus.

<a id="api-38cd4b7cffcb65ad"></a>

### [`void LayerView<TView, TLayer>.OnChar(ref KeyEventRef e)`](#api-38cd4b7cffcb65ad)


```csharp
public override void OnChar(ref KeyEventRef e);
```

Called when a character is input while this view has focus.

<a id="api-41d2375f8b70b854"></a>

### [`void LayerView<TView, TLayer>.OnFocus()`](#api-41d2375f8b70b854)


```csharp
protected internal override void OnFocus();
```

Called when this view receives keyboard focus.

<a id="api-5124955ead84366b"></a>

### [`void LayerView<TView, TLayer>.OnKeyDown(ref KeyEventRef e)`](#api-5124955ead84366b)


```csharp
public override void OnKeyDown(ref KeyEventRef e);
```

Called when a key is pressed while this view has focus.

<a id="api-2c2e684284b8db54"></a>

### [`void LayerView<TView, TLayer>.OnPointerEvent(ref PointerEventRef e, EventPhase phase)`](#api-2c2e684284b8db54)


```csharp
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
```

Called during event dispatch to handle a pointer event in a specific event phase.

<a id="api-55261692a222f78f"></a>

### [`void LayerView<TView, TLayer>.RenderCore(IContext context)`](#api-55261692a222f78f)


```csharp
protected override void RenderCore(IContext context);
```

Override to render this view and its children.


<a id="api-58aad8df3817bd2a"></a>

## `struct TextInputLayer`

A leaf layer that implements single-line text input: typing, selection, caret blinking, password masking, and mouse-driven selection. Shares document state with native text input adapters. 

The layer stores the arranged `Xui.Core.UI.Layer.TextInputLayer.contentRect` during [`Xui.Core.UI.Layer.TextInputLayer.Arrange(Xui.Core.UI.View,Xui.Core.Math2D.Rect,Xui.Core.Canvas.IMeasureContext)`](../xui-core-ui-layer/index.md#api-016b25b3e754224c) so that [`Xui.Core.UI.Layer.TextInputLayer.Render(Xui.Core.UI.View,Xui.Core.Canvas.IContext)`](../xui-core-ui-layer/index.md#api-8ce64ce20d613f68) and pointer hit-testing both know the exact text area, independent of any border or padding applied by a wrapping layer.

```csharp
public struct TextInputLayer : ILayer<View>
{
    public TextEditingState Editor { get; }
    public bool NativeSelection { get; set; }
    public bool HasText { get; }
    public string Text { get; set; }
    public Interval<uint>.ClosedOpen Selection { get; set; }
    public bool IsPassword { get; set; }
    public bool SelectAllOnFocus { get; set; }
    public Func<char, bool>? InputFilter { get; set; }
    public Color Color { get; set; }
    public Color SelectedColor { get; set; }
    public Color SelectionBackgroundColor { get; set; }
    public CornerRadius SelectionCornerRadius { get; set; }
    public Frame Padding { get; set; }
    public Font Font { get; set; }

    public Size Measure(View view, Size availableSize, IMeasureContext context);
    public void Arrange(View view, Rect rect, IMeasureContext context);
    public void Render(View view, IContext context);
    public void Animate(View view, TimeSpan previousTime, TimeSpan currentTime);
    public void OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase);
    public void OnKeyDown(View view, ref KeyEventRef e);
    public void OnChar(View view, ref KeyEventRef e);
    public void OnFocus(View view);
    public void OnBlur(View view);
    public Rect GetCaretRect(View view, int offset, ITextMeasureContext measure);
    public int GetTextPosition(View view, Point point, ITextMeasureContext measure);
}
```

<a id="api-f1e4dbf90d168760"></a>

### [`void TextInputLayer.Animate(View view, TimeSpan previousTime, TimeSpan currentTime)`](#api-f1e4dbf90d168760)


```csharp
public void Animate(View view, TimeSpan previousTime, TimeSpan currentTime);
```

Advances time-based state (animations, blinking cursors, etc.).

<a id="api-016b25b3e754224c"></a>

### [`void TextInputLayer.Arrange(View view, Rect rect, IMeasureContext context)`](#api-016b25b3e754224c)


```csharp
public void Arrange(View view, Rect rect, IMeasureContext context);
```

Finalises position and size within `rect`.

<a id="api-dd604bbbf69a05ba"></a>

### [`Color TextInputLayer.Color`](#api-dd604bbbf69a05ba)


```csharp
public Color Color { get; set; }
```

Normal text color.

<a id="api-f1c701c3d46806b3"></a>

### [`TextEditingState TextInputLayer.Editor`](#api-f1c701c3d46806b3)


```csharp
public TextEditingState Editor { get; }
```

The editing state shared with native adapters.

<a id="api-404e9666384cdf32"></a>

### [`Font TextInputLayer.Font`](#api-404e9666384cdf32)


```csharp
public Font Font { get; set; }
```

Font used for input measurement, hit testing, and rendering.

<a id="api-4c934f0b47cc05ff"></a>

### [`Rect TextInputLayer.GetCaretRect(View view, int offset, ITextMeasureContext measure)`](#api-4c934f0b47cc05ff)


```csharp
public Rect GetCaretRect(View view, int offset, ITextMeasureContext measure);
```

Returns caret geometry in window coordinates.

<a id="api-64062a88b44c2bff"></a>

### [`int TextInputLayer.GetTextPosition(View view, Point point, ITextMeasureContext measure)`](#api-64062a88b44c2bff)


```csharp
public int GetTextPosition(View view, Point point, ITextMeasureContext measure);
```

Hit-tests text using a point in window coordinates.

<a id="api-b248b5ace9d6989d"></a>

### [`bool TextInputLayer.HasText`](#api-b248b5ace9d6989d)


```csharp
public bool HasText { get; }
```

Whether the input contains text, without allocating a string.

<a id="api-a5fa5016b7ea7d9e"></a>

### [`Func<char, bool>? TextInputLayer.InputFilter`](#api-a5fa5016b7ea7d9e)


```csharp
public Func<char, bool>? InputFilter { get; set; }
```

Optional character filter. Return true to accept, false to reject.

<a id="api-5e14434d5a0aab72"></a>

### [`bool TextInputLayer.IsPassword`](#api-5e14434d5a0aab72)


```csharp
public bool IsPassword { get; set; }
```

When true, displays bullet characters instead of the actual text.

<a id="api-52e1198a235d0e81"></a>

### [`Size TextInputLayer.Measure(View view, Size availableSize, IMeasureContext context)`](#api-52e1198a235d0e81)


```csharp
public Size Measure(View view, Size availableSize, IMeasureContext context);
```

Returns the desired border-edge size given the available space.

<a id="api-d38f04d046f3e76d"></a>

### [`bool TextInputLayer.NativeSelection`](#api-d38f04d046f3e76d)


```csharp
public bool NativeSelection { get; set; }
```

Whether the platform draws and manipulates the selection.

<a id="api-cdf375f55a53a028"></a>

### [`void TextInputLayer.OnBlur(View view)`](#api-cdf375f55a53a028)


```csharp
public void OnBlur(View view);
```

Called when the host view loses keyboard focus.

<a id="api-b4081506bd97e29a"></a>

### [`void TextInputLayer.OnChar(View view, ref KeyEventRef e)`](#api-b4081506bd97e29a)


```csharp
public void OnChar(View view, ref KeyEventRef e);
```

Handles a character input event while the host view has focus.

<a id="api-1ab77f1629d6f1ba"></a>

### [`void TextInputLayer.OnFocus(View view)`](#api-1ab77f1629d6f1ba)


```csharp
public void OnFocus(View view);
```

Called when the host view gains keyboard focus.

<a id="api-3dd201124e66aa8d"></a>

### [`void TextInputLayer.OnKeyDown(View view, ref KeyEventRef e)`](#api-3dd201124e66aa8d)


```csharp
public void OnKeyDown(View view, ref KeyEventRef e);
```

Handles a key-down event while the host view has focus.

<a id="api-f534db39a031fd47"></a>

### [`void TextInputLayer.OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase)`](#api-f534db39a031fd47)


```csharp
public void OnPointerEvent(View view, ref PointerEventRef e, EventPhase phase);
```

Handles a pointer event in the given dispatch phase.

<a id="api-ab9c9de635272262"></a>

### [`Frame TextInputLayer.Padding`](#api-ab9c9de635272262)


```csharp
public Frame Padding { get; set; }
```

Inset applied to the arranged rect before text layout and hit-testing.

<a id="api-8ce64ce20d613f68"></a>

### [`void TextInputLayer.Render(View view, IContext context)`](#api-8ce64ce20d613f68)


```csharp
public void Render(View view, IContext context);
```

Draws content. Called after Arrange.

<a id="api-c99fe07a14c23b6b"></a>

### [`bool TextInputLayer.SelectAllOnFocus`](#api-c99fe07a14c23b6b)


```csharp
public bool SelectAllOnFocus { get; set; }
```

When true (default), selects all text when the view gains focus.

<a id="api-8c332821b14cd39f"></a>

### [`Color TextInputLayer.SelectedColor`](#api-8c332821b14cd39f)


```csharp
public Color SelectedColor { get; set; }
```

Color of text inside the selection highlight.

<a id="api-41823aa9af0792bc"></a>

### [`ClosedOpen TextInputLayer.Selection`](#api-41823aa9af0792bc)


```csharp
public Interval<uint>.ClosedOpen Selection { get; set; }
```

Gets or sets the selection as a half-open interval [Start, End). Start == End represents the caret position.

<a id="api-20ad4d58d584373a"></a>

### [`Color TextInputLayer.SelectionBackgroundColor`](#api-20ad4d58d584373a)


```csharp
public Color SelectionBackgroundColor { get; set; }
```

Background color drawn behind selected text.

<a id="api-27858b01e6fa379a"></a>

### [`CornerRadius TextInputLayer.SelectionCornerRadius`](#api-27858b01e6fa379a)


```csharp
public CornerRadius SelectionCornerRadius { get; set; }
```

Corner radius of the selection highlight rectangle. Zero by default.

<a id="api-500fe67757e51e4f"></a>

### [`string TextInputLayer.Text`](#api-500fe67757e51e4f)


```csharp
public string Text { get; set; }
```

Gets or sets the text content.

