# Sandbox.Rendering.HudPainter.DrawRect

```csharp
void DrawRect(in Rect rect, in Color color, in Vector4 cornerRadius = null, in Vector4 borderWidth = null, in Color borderColor = null)
```

Draws a rectangle with optional corner radius and border.

### Parameters

- `in rect` (`Rect`): The rectangle to draw.
- `in color` (`Color`): The fill color of the rectangle.
- `in cornerRadius` (`Vector4`), default `null`: Corner radii as (bottom-right, top-right, bottom-left, top-left). Radii too big for the rect are scaled to fit, like CSS.
- `in borderWidth` (`Vector4`), default `null`: The width of the border for each edge (optional).
- `in borderColor` (`Color`), default `null`: The color of the border (optional).

Declared in [Sandbox.Rendering.HudPainter](/api/Sandbox.Rendering.HudPainter).
Assembly: `Sandbox.Engine`.
