functions

Constraint
Edited: Sunday 25 January 2026

Constraint

Category: Utilities
File: layouts.go
Package: ui

Signature

1func Constraint(width, height int, w W) W

Description

Constraint limits a widget’s maximum dimensions to the specified width and height.
Forces the widget to render within these bounds.

Example:

limited := Constraint(200, 100, Label("Limited size"))

Useful for creating fixed-size containers or limiting widget expansion.

Examples

Constraint

1{
2	limited := Constraint(200, 100, Label("Limited size"))
3	_ = limited
4}

Example Output


This documentation is auto-generated. To update, run make docs

Backlinks