Hide admin tab depending on sibling data

default discord avatar
chris_heinz
5 months ago
1

I am trying to hide/show a tab if a certain field is checked. Unfortunately my code within the condition is never called. It works perfectly fine as expected if I do the same in fields within the tab but not on tab level. Is there another way to conditionally hide a whole tab?


fields: [
    {
      type: "tabs",
      tabs: [
        {
          label: "SEO"
           admin: {
            condition: (doc, siblingData) => {
              // does not get called so the scope is not even reached
              console.log(siblingData);
              return siblingData?.overwriteMeta;
            },
          },
          fields: [here condition works fine]
       ]}]
  • discord user avatar
    jesschow
    Payload Team
    2 months ago

    @chris_heinz I believe conditional tabs is on our roadmap still

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.