You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A clear and concise description of what the bug is.
dependencies :
"@formio/js": "5.0.0-dev.5621.91bd945",
"@formio/react": "6.0.0-dev.568.ced0fbd",
const FieldComponent = Components.components.field;
import { getSingleChoiceQn } from "../customComponents/getSingleChoiceQn";
class SingleChoiceQnRender extends FieldComponent {
// Define the schema for the custom component
static schema(...extend) {
return FieldComponent.schema({
type: "customcomponent", // The type identifier for this component
key: "customComponent",
inputType: "select",
input: true,
data: {
values: [
{ label: "Yes", value: "yes" },
{ label: "No", value: "no" },
],
options: [],
},
...extend,
});
}
// Define the information for the builder (drag and drop interface)
static get builderInfo() {
return {
title: "Single Choice Question",
group: "basic", // The group under which the component appears
icon: "fa fa-toggle-on", // Icon for the component in the builder
weight: 0, // Position in the list
schema: SingleChoiceQnRender.schema(),
};
}
// Render the select dropdown with "Yes" and "No" options
render() {
const labels = this.component.data.values; // Get the labels from the schema
const SingleChoiceQnHtml = getSingleChoiceQn({
value: this.dataValue,
onChange: (event) => this.updateValue(event.target.value),
labels: labels,
});
return super.render(SingleChoiceQnHtml);
}
// Attach event listeners to the select input
attach(element) {
this.loadRefs(element, { input: "single" });
if (this.refs.input) {
this.refs.input.addEventListener("change", (event) => {
this.updateValue(event.target.value);
});
}
return super.attach(element);
}
get defaultSchema() {
return SingleChoiceQnRender.schema();
}
}
export default SingleChoiceQnRender
Describe the bug
A clear and concise description of what the bug is.
dependencies :
"@formio/js": "5.0.0-dev.5621.91bd945",
"@formio/react": "6.0.0-dev.568.ced0fbd",
To Reproduce
Steps to reproduce the behavior:
Expected behavior
custom single select component should visible in the basic group components
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
how we can add custom component in groups
The text was updated successfully, but these errors were encountered: