Cogent Core Docs

0%

Loading...

Static preview:

Cogent Core DocsWidgetsCollections

Forms

Cogent Core provides interactive forms that allow you to display a struct value to users and have them edit it.

You can make a form from any struct pointer:

Name

Age

You can make a form that fits in one line:

Name

Age

You can detect when the user changes the value of the form:

Name

Age

You can make it so that change events are sent immediately as the user types:

Name

Age

You can hide certain fields from the user:

Name

You can prevent the user from editing certain fields:

Name

Age

You can prevent the user from editing the entire form:

Name

Age

You can change the label of a field:

Nickname

Age

You can use structs with embedded fields:

Person

Name

Age

Role

You can display fields that are themselves structs:

Role

Manager

Name

Age

You can expand fields that are themselves structs:

Role

Manager • name

Manager • age

You can specify a default value (or list or range of values) for a field, which will be displayed in the tooltip for the field label, make the label highlighted when the value is non-default, and allow the user to reset the value to the default value by double clicking on the label:

Name

Age

Precision

You can make a button that opens up a dialog with a form:

struct { Name string; Age int }

You can make it so that the documentation comments for struct fields are used as tooltips for the label and value widgets of a form by adding the type to types and running core generate: