canvas.Rectangle is the simplest canvas object in Fyne. It displays a block of the specified colour. You can also set the colour using the FillColor field.

In this example the rectangle fills the window as it is the only content element.

package main

import (


func main() {
	myApp := app.New()
	w := myApp.NewWindow("Rectangle")

	rect := canvas.NewRectangle(color.White)

	w.Resize(fyne.NewSize(150, 100))

Other fyne.CanvasObject types have more configuration, let us look next at canvas.Text.