Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Controls

James Clancey edited this page Feb 10, 2022 · 8 revisions

Comet Controls

Controls in Comet are lightweight. In order to keep them lightweight, each control has only 1-2 read-only constructor parameters.

View

View is the base type for all UI in Comet. Views are composable and can have a Body. The body can be specified by the [Body] attribute, or by setting the Body function.

Attribute:

class MyView : View 
{
	[Body]
	View view() => new VStack{
		new Text("Hello World")
	};
}

Function:

class MyView : View
{
	public MyView()
	{
		Body = () => new VStack{
			new Text("Hello World")
		};
	}
}

Text

Text is used to display a string on the screen.

Constructor Parameters

Name Type Description
Value String The text value to be displayed

Example:

new Text("Hello World")

Button

A button is used to display a string on the screen.

Constructor Parameters

Name Type Description
Text String The text value to be displayed
Clicked Action The action that fires when clicked/tapped

Example:

new Button("Click me!",()=> Console.WriteLine("I was clicked"))

ActivityIndicator

Displays a loading indicator.

Constructor Parameters

Name Type Description

Example:

new ActivityIndicator()

CheckBox

Constructor Parameters

Name Type Description
IsChecked bool Toggles the checked state

Example:

new CheckBox(true)

DatePicker

A Datepicker.

Constructor Parameters

Name Type Description
Date DateTime The current value
MinimumDate DateTime The Minimum value
MaximumDate DateTime The Maximum value

Example:

new DatePicker(DateTime.Today)

Image

Displays an image.

Constructor Parameters

Name Type Description
ImageSource String,ImageSource This value can be a string or an ImageSource. If its a string it can be a file path or url

Example:

new Image("comet_logo.png")

ListView

ProgressBar

RefreshView

ScrollView

SearchBar

SecureField

ShapeView

Slider

Spacer

Stepper

TabView

TextEditor

TextField

TimePicker

Toggle

WebView

Layouts

HStack

VStack

ZStack

HGrid

VGrid

Grid

Clone this wiki locally