Populate custom dropdown

Say you have a default dropdown with predefined values:

We could define in the slide settings the following information:

This way, we can use the SDK to populate this information based on any condition. For example the colors defined in the slide metadata:

function Form() {
    const { slideModel } = useContext(SlideContext);

    let field = slideModel.getFieldById(105);
    field.removeOptions();
    slideModel.getMetaValue('colors').forEach(o => field.addOption(o.id, o.title));

    return (
        <FormFields fields={slideModel.getFields()} />
    );
}

The result will be:

Last updated