Skip to content

Tab

The Tab class is used to create tabs in a resource or user.

Available methods:

MethodDescription
id(string $id)Sets the tab identifier (optional).
position(int $position)Sets the tab position
description(string $description)Sets the tab description.
fields(array $fields)Defines the list of fields within the tab.
permissions(array $permissions)Controls where the element is shown based on conditions.
Permissions
RuleDescription
resourceComma-separated list of resource IDs. Tab is shown only on these resources.
parentParent resource ID(s). Tab is shown only for children of these parents.
templateTemplate ID(s). Tab is shown only on resources with these templates.
userUser ID(s). Tab is shown only for these users.
user_groupUser group ID(s). Tab is shown only to users in these groups.

Example usage:

php
Tab::make('Custom tab')
    ->id('extra')
    ->position(2)
    ->fields([
        Field::make('notes')->type('textarea')->label('Notes'),
        Field::make('status')->type('select')->values([
            'active' => 'Active',
            'inactive' => 'Inactive'
        ]),
    ]);

This example creates a "Custom tab" with id = extra, which will be the second tab in order and contain two fields.

php
Tab::make('SEO')->fields([
    Field::make('meta_title')->label('Meta Title'),
    Field::make('meta_description')->type('textarea')->label('Meta Description')
]);

© PageBlocks 2019-present