Docs / Inlay / Organising the Inspector

Organising the inspector

section(), tab() and badge() structure the settings inspector. They don't change the data a section stores.

Sections

section() groups fields under a named, collapsible heading. It's presentation only - unrelated to group(), which is a data shape.

Settings::make()
    ->section('Content', function (Settings $settings) {
        $settings->text('heading')->label('Heading')->required()->default('Welcome');
        $settings->textarea('subheading')->label('Subheading')->default('');
    })
    ->section('Appearance', function (Settings $settings) {
        $settings->select('alignment')->label('Alignment')->options(['left' => 'Left', 'center' => 'Centred'])->default('left');
    });

Tabs

tab() works the same way but renders tab navigation - only when a section declares more than one tab. A section() inside a tab() callback produces a collapsible group within that tab.

Settings::make()
    ->tab('Content', function (Settings $settings) {
        $settings->text('heading')->label('Heading')->default('Welcome');
    })
    ->tab('SEO', function (Settings $settings) {
        $settings->text('metaTitle')->label('Meta title')->default('');
    });

Badges

badge() shows a short callout next to a field's label:

$settings->link('cta')->label('Button')->badge('New');

Conditional visibility

visibleWhen() and hiddenWhen() show or hide a field based on another field's value. They're a UI convenience, not a security boundary.

Settings::make()
    ->toggle('showCta')->label('Show call to action')->default(false)
    ->text('ctaLabel')->label('Button label')->visibleWhen('showCta', true)->default('');

Your view makes the same decision with the value:

@if ($showCta)
    <a href="#">{{ $ctaLabel }}</a>
@endif

Instance labels

The editor's section list labels each section with its name plus a short detail, so three heroes read as Hero - "Welcome", Hero - "Our story" and so on.

By default it uses the first of a setting named heading, title, name or label, then the first text() setting. It only ever uses a short text field, never a textarea, rich text, image or structured field.

Name the field explicitly when the guess is wrong:

Settings::make()
    ->text('eyebrow')->label('Eyebrow')->default('')
    ->text('headline')->label('Headline')->default('Welcome')
    ->instanceLabel('headline');

instanceLabel() only takes effect for a text() field.

Discovery Call

One call.
We'll both know.

20 minutes to walk through your project, ask the hard questions, and work out honestly if we're the right team for it.

  • One call per day - it gets our full attention
  • Australia's only Laravel Premier Partner
  • Trusted by Chemist Warehouse, HelloFresh and Youfoodz
  • Senior engineers only - no juniors on your project
  • Brisbane-based, onshore team

Press Esc to close  ·  B to reopen