Reusing Content Editors

It's very easy to reuse any of the built in Content Editors, like the ContentPicker or IconPicker, whatever you want, they are just Blazor components that have some required parameters. Example below of reusing the Content Picker

<ContentPickerProperty
    Value="@MyStringId"
    Settings="@(JsonSerializer.Serialize(new ContentPickerSettings { MaxAllowed = 1 }))"
    ValueChanged="@(e => MyStringId = e.ToString())"/>

Value = The initial value you want to pass in to the picker, so if you want an item preselected in this case

Settings = Some editors have settings, you can pass them in by serialising them

ValueChanged = What to do when the value is updated / changed in the editor.

All editors follow a similar format and all have the Value and ValueChanged parameters.

Last updated