JsonForm
fun JsonForm(schema: Schema, uiSchema: UiSchema, modifier: Modifier = Modifier, state: JsonFormState = rememberJsonFormState(initialValues = mutableMapOf()), layoutContent: @Composable RendererLayoutScope.(@Composable (UiSchema) -> Unit) -> Unit, stringContent: @Composable RendererStringScope.(id: String) -> Unit, numberContent: @Composable RendererNumberScope.(id: String) -> Unit, booleanContent: @Composable RendererBooleanScope.(id: String) -> Unit)
Display a form described in a Schema and UiSchema. If you want to interact with the form, you can declare your own state before the declaration of this component and pass it as parameter. You'll be able to interact with fields of the form. If you want to override a specific field of your form, you can add a custom render in the sniper parameter.
val schema = Schema(
properties = mutableMapOf("email" to StringProperty()),
required = arrayListOf("email")
)
val uiSchema = vertical {
control("#/properties/email") {
label = "Email"
}
}
val jsonFormsState = rememberJsonFormState(initialValues = mutableMapOf())
JsonForm(
schema = schema,
uiSchema = uiSchema,
state = jsonFormsState
)
Content copied to clipboard