ListField
constructor(label: String, initialValue: List<Value>, elementField: ListField.ElementFieldScope.() -> MutablePreviewLabField<Value>, defaultValue: () -> Value = {
initialValue.firstOrNull()
?: error("ListField requires a non-empty initialValue or an explicit defaultValue")
})
Parameters
Value
The type of elements in the list.
label
Label displayed in the UI for this field.
initialValue
Initial list 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.