This repository was archived by the owner on Dec 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
This repository was archived by the owner on Dec 25, 2025. It is now read-only.
Custom component interface #79
Copy link
Copy link
Open
Labels
featureNew feature or requestNew feature or requestpackage:coreRelated to @fabrix-framework/fabrixRelated to @fabrix-framework/fabrix
Milestone
Description
Currently, no interface available to pass props to the component registered on the component registry.
This PR is a design proposal to implement a feature to get a custom React component that internally composes FabrixComponent with interface that can accept props that the corresponding custom component requires.
Design
// table.tsx
type MyTableProps = {
onClickRow: (rowID: string) => void;
}
export MyTable = (props: TableComponentProps<MyTableProps>) => {
const columnDefs = props.headers.map((header) => {
return {
headerName: header.key,
field: header.label,
enableValue: true,
enableRowGroup: true,
enablePivot: true,
};
});
return (
<Datagrid
columns={columnDefs}
onClickRow={(row: Row) => {
props.onClickRow(row.id)
}}
/>
)
}// components.tsx
const customComponents = new ComponentRegistry({
custom: [
{
type: "table",
name: "myCustomTable",
table: (props: TableComponentProps<MyTableProps>) => {
return (
<Datagrid onClickRow={props.onClickRow} />
)
}
}
]
})// page.tsx
const MyCustomTable = customComponents.getComponent("myCustomTable")
const Page = () => {
return (
<MyCustomTable
query={gql`
manufacturingOrders {
collection {
name
id
}
}
`}
props={{
onClickRow: (rowID) => {
// implement handler here
}
}}
/>
)
}Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or requestpackage:coreRelated to @fabrix-framework/fabrixRelated to @fabrix-framework/fabrix
Type
Projects
Status
Done