how to add parent attribute to resource
i tried to add a parent to my resource but there is no parent attributes
9 Replies
Hi @saji_nael. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To add a parent to your resource, you can use the
meta.parent
property in the resource object. Here's an example of how to do this:
In this example, the child
resource is nested under the parent
resource. Make sure the meta.parent
value matches the name of the parent resource you want to nest under.
For more information on multi-level menus and nesting resources, you can refer to this documentation (https://refine.dev/docs/advanced-tutorials/multi-level-menu).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@1000087684632547538> kapa.ai is still learning and improving, please let us how it did by reacting below
foreign-sapphireOP•2y ago
i tried to add this meta: {
parent: "parent",
},
and I got a compiler error
@kapa.ai
Let me check the knowledge base for you. One moment! :books:
Sorry @saji_nael, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
ratty-blush•2y ago
Hey @saji_nael, in the
resources
property;
you can do as follows:
Even if there's no CMS
resource, it will be accepted as parent and menu will be rendered accordingly.
If this gives you errors, can you please share the error? We can try to find a solution to it.foreign-sapphireOP•2y ago

foreign-sapphireOP•2y ago
here is my code
it is not working
i got compile error for meta
Type '{ name: string; create: FC<{}>; edit: FC<any>; show: FC<any>; list: FC<{}>; canDelete: true; meta: { parent: string; }; }' is not assignable to type 'ResourceProps'.
Object literal may only specify known properties, and 'meta' does not exist in type 'ResourceProps'
ratty-blush•2y ago
Looks like you are using v3, you can do { name: "posts", parentName: "parent" }
foreign-sapphireOP•2y ago
thank you