To create a component and register it in the Backend it is necessary to create a Widget
In the example below, we will create a custom component and demonstrate how to register it in the backend. This component will consist of:
The buttons in this component are responsible for increasing and decreasing the size of the title text in the component and it will look like the following image:
@RegisterWidget
and some extensions like the Widget
class. Below we will show the when and how.To create a widget:
"CustomWidgetTitleIncrease"
@RegisterWidget
annotation to this class;Widget
interfaceimport br.com.zup.beagle.annotation.RegisterWidget
import br.com.zup.beagle.widget.Widget
@RegisterWidget
class CustomWidgetTitleIncrease(
val title: String,
val buttonTitle1: String,
val buttonTitle2: String
) : Widget()
Once configured, it is now possible to use this component and set the properties listed above from the backend.
When creating the component on the front end, it will also be necessary to create a Widget with the same name as the one used on the backend. This will register it on the frontend and allow it to receive the information sent from the backend.
After implementing it on the front, just run your application and it will be displayed as in the image below:
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.