I want to create a button folder in the prespective component->rad component example and move two action buttons that i have created, the button folder shall open and close and shows inside buttons
Reading this makes me feel like an LLM being treated like a Google search engine
jokes jokes, but really if you elaborate and share examples and specific requests, there’s lots of people happy to help here
This.
This is a community forum to help each other, not a place to look for volunteers to do your work for you
I am extending this project and want to add a button folder in the prespective component-> rad component. I have created two new buttons with name as screencapture and csvtoalarmlogconverter and want to move those inside a button folder and the name of the button folder would be actionbuttons. I am not a full stack developer, just learning by doing
I am still not 100% sure I am following the goal here
But maybe my guess is you are looking to put your components into a dedicated Palette category in the perspective component browser? To do that, you need to change what you are providing .setPaletteCategory(ExampleComponents.COMPONENT_CATEGORY)
in your descriptor.
Maybe going through this detailed tutorial I wrote my help: Introduction | Example Perspective Component Module
Here is the source repo for that tutorial:
Thank you for your reply. The goal here is to create a dropdown button folder in the example UI Library component and move example button and checkbox button inside it. As per the example given by you in the repo and i tried that too. I want to have similar structure like Input->Button->Primary, secondary. See attached images for reference. Once it works i want to create the similar button folder in the Rad things and move CsvtToAlarmLog and ScreenCapture button inside it
I understand now. I believe you are looking to add Variants
to your component?
Keep in mind, and someone at IA can correct me if I am wrong, but the only differences you can have in your variant from a user standpoint are a base difference of props. I believe the intent is for each of the elements in the list to be the same, with just different default props applied.
That being said, heres how to achieve it.
On your actual component builder, there is an addPalleteEntry
method that can add these additional variants for you, See the docs page here
Lets say in our button example, you wanted to add a second variant that has a default text set to it, you could create a custom JsonObject with the props you want to set, and then just add the palette entry in your builder.
static JsonObject customButtonProps = new JsonObject();
static {
customButtonProps.addProperty("text", "Click Me");
}
public static ComponentDescriptor DESCRIPTOR = ComponentDescriptorImpl.ComponentBuilder.newBuilder()
.setPaletteCategory(ExampleComponents.COMPONENT_CATEGORY)
.setId(COMPONENT_ID)
.setModuleId(Constants.MODULE_ID)
.setSchema(ComponentUtilities.getSchemaFromFilePath(PROPS_SCHEMA_PATH))
.setEvents(List.of(ActionPerformedDescriptor))
.setName(COMPONENT_NAME)
.addPaletteEntry("", COMPONENT_NAME, COMPONENT_DESCRIPTION, thumbnail, null)
.setDefaultMetaName(COMPONENT_DEFAULT_NAME)
.setResources(ExampleComponents.BROWSER_RESOURCES)
.addPaletteEntry("default-text-button", "Button with Default Text", "A button with default text", thumbnail, customButtonProps)
.build();
Also, I updated my example project to show adding component variants in detail.
Let me know if anything is unclear or I should add more info!
It is now somewhat working, what I am trying here is the buttonfolder shall have different icon and button shall have different icon. I tried that, but it is taking same icon and the buttonfolder with svg icon is coming as a separate entity and also button is coming under it. If we create a two java classes then to access the private attributes u need getter and setter or make them as a public. That is not advised, i wish we can setup a teams call. So that i can explain the issue better