Cogent Core Docs • Widgets • Collections
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:
You can make a form that fits in one line:
You can detect when the user changes the value of the form:
You can make it so that change events are sent immediately as the user types:
You can hide certain fields from the user:
You can prevent the user from editing certain fields:
You can prevent the user from editing the entire form:
You can change the label of a field:
You can use structs with embedded fields:
Role
You can display fields that are themselves structs:
You can expand fields that are themselves structs:
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:
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
: