This repository was archived by the owner on Jul 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
Controls
James Clancey edited this page Feb 10, 2022
·
8 revisions
Controls in Comet are lightweight. In order to keep them lightweight, each control has only 1-2 read-only constructor parameters.
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 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")
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"))
Displays a loading indicator.
Constructor Parameters
| Name | Type | Description |
|---|
Example:
new ActivityIndicator()
Constructor Parameters
| Name | Type | Description |
|---|---|---|
| IsChecked | bool | Toggles the checked state |
Example:
new CheckBox(true)
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)
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")