Skip to content

Tab

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

Usage example:

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.

Available methods:

position(int $position) – Sets the tab position.

If not specified, the tab is added at the end of the standard ones.

php
Tab::make('Main')->position(1);

id(string $id) – Sets the tab identifier (optional).

php
Tab::make('Settings')->id('settings');

fields(array $fields) – Defines the list of fields inside the tab.

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

© PageBlocks 2019-present