SetField

constructor(label: String, initialValue: Set<Value>, elementField: SetField.ElementFieldScope.() -> MutablePreviewLabField<Value>, defaultValue: () -> Value = { initialValue.firstOrNull() ?: error("SetField requires a non-empty initialValue or an explicit defaultValue") })

Parameters

Value

The type of elements in the set.

label

Label displayed in the UI for this field.

initialValue

Initial set value.

elementField

Factory function to create a field for each element. Receives ElementFieldScope with the element's label (index) and initial value.

defaultValue

Factory function to create a default value when inserting new elements. Defaults to the first element of initialValue if available.