# Editor.Widget.ConstrainTo

```csharp
void ConstrainTo(Rect parentRect)
```

Reposition this widget to ensure it is within the given rectangle.

### Parameters

- `parentRect` (`Rect`): Rectangle to constraint to, relative to the parent widget.

Declared in [Editor.Widget](/api/Editor.Widget).
Assembly: `Sandbox.Tools`.
