Adding tabs to a document in the structure builder using plugins.
27 replies
Last updated: Dec 3, 2021
E
Is there a easy way to add Tabs per say to a document in the structure builder?
Dec 3, 2021, 3:42 PM
You can use fieldsets to group things without affecting the actual data structure.
Then there’s a plugin for Sanity that will turn your fieldset groups into tabs.
Then there’s a plugin for Sanity that will turn your fieldset groups into tabs.
Dec 3, 2021, 3:42 PM
Dec 3, 2021, 3:43 PM
E
Perfect!
Dec 3, 2021, 3:44 PM
S
user S
using that plugin forces you to create an object which is changing the data structureDec 3, 2021, 3:44 PM
Yes - I just realised that. It’s either changed or I was thinking of a different one. Thanks for pointing that out
user S
Dec 3, 2021, 3:45 PM
E
Well, we aren't set on data structure yet so I think this still works. Would there be a drawback to using a object to group fieldsets?
Dec 3, 2021, 3:46 PM
S
Let me know if you find one without structure changes. I'm looking for that :)
Dec 3, 2021, 3:47 PM
E
Dec 3, 2021, 3:47 PM
E
This seems to be 'define fieldsets', 'specify fieldset' right?
Dec 3, 2021, 3:47 PM
E
Which is good, maybe not the fact its 'ALPHA ALPHA ALPHA' haha
Dec 3, 2021, 3:47 PM
Actually - I think that’s just the example. I believe in the one I linked you can apply that to the parent document / object so that it ISN’t affecting your structure.
Dec 3, 2021, 3:48 PM
I could be wrong though. I used something like this on a project last year and it didn’t require schema changes.
Dec 3, 2021, 3:49 PM
E
I'm pretty much there so I'll just try it out and see ha
Dec 3, 2021, 3:49 PM
E
So -- didn't have to create a object.
Dec 3, 2021, 3:51 PM
E
But I only get fieldsets, no tabs ha
Dec 3, 2021, 3:52 PM
E
Probably cause i'm not using the 'inputComponent', which seems to be required as a object?
Dec 3, 2021, 3:52 PM
E
No.. but I guess that has to be a top level object in the document fields?
Dec 3, 2021, 3:53 PM
E
Right, how do I specify it to be used without nesting my document under a Object?
Dec 3, 2021, 3:53 PM
I think it would be…
{ type: "document", title: `Frontpage`, name: `frontpage`, inputComponent: Tabs, fieldsets: [...] fields: [...] }
Dec 3, 2021, 3:54 PM
E
Cool so I have tabs and didn't have to change any structure.
Dec 3, 2021, 3:56 PM
S
oh that's cool.
Dec 3, 2021, 4:12 PM
S
This is for this plugin right?
https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1638546212277600?thread_ts=1638546123.277200&cid=C9Z7RC3V1
https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1638546212277600?thread_ts=1638546123.277200&cid=C9Z7RC3V1
Dec 3, 2021, 4:13 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.