Skip to content

Block Types ​

Kompass ships with a set of built-in block types that cover the most common content patterns. Each block has its own Blade view, a set of editable fields, and configurable layout options. You can also create custom blocks at any time.

Overview ​

Blocks are the building units of every page and post. Editors add them from the block palette inside the Block Builder, arrange them by drag & drop, and configure each block independently — no page rebuild needed.

Every block shares a common set of layout settings:

SettingOptionsDescription
Grid span1–12How many grid columns the block occupies
Layoutfullpage, popout, contentWidth variant relative to the page container
Alignmentalign-left, align-center, align-rightHorizontal text alignment
CSS classfree textExtra Tailwind or custom classes on the block wrapper
ID anchorfree textHTML id for scroll-to-section links
Statuspublished, draftHide a block without deleting it

Button ​

A single call-to-action link rendered as a button. It uses the link field type, which contains the URL, title, target, and icon settings.

FieldTypeDescription
LinklinkObject containing URL, Title, Target, and Icon
blade
@props(['item' => ''])

@if($item->type == 'button')
@php
    $link = get_field_as('link', $item->datafield, 'object');
@endphp

@if($link)
    <a href="{{ $link->url }}" 
       target="{{ $link->target ?? '_self' }}" 
       class="btn btn-primary {{ get_meta($item, 'css-classname', '') }}">
        
        @if(($link->iconclass ?? null) && ($link->iconposition ?? 'left') == 'left')
            <x-icon :name="$link->iconclass" class="w-5 h-5 mr-2" />
        @endif
        
        {{ $link->title }}

        @if(($link->iconclass ?? null) && ($link->iconposition ?? 'left') == 'right')
            <x-icon :name="$link->iconclass" class="w-5 h-5 ml-2" />
        @endif
    </a>
@endif
@endif

WYSIWYG (Textblock) ​

A rich text block powered by the Kompass Editor. Editors write and format content directly in the block — no switching context.

FieldTypeDescription
ContentwysiwygBlock-based rich text
blade
@props(['item' => ''])

@if($item->type == 'wysiwyg')
@php
    $raw    = get_field('wysiwyg', $item->datafield);
    $blocks = wysiwyg_blocks($raw);
@endphp
<div class="prose">
    @foreach($blocks as $block)
        {{-- render logic --}}
    @endforeach
</div>
@endif

An image grid that supports multiple images, configurable column counts, and an optional photo slider.

FieldTypeDescription
ImagesgalleryCollection of images
blade
@props(['item' => ''])

@if($item->type == 'gallery')
<div class="md:grid gap-4 grid-cols-{{ $item->grid }}">
    @foreach($item->datafield as $image)
        <x-image :id="$image['data']" class="w-full h-full rounded-lg" />
    @endforeach
</div>
@endif

Group (Layout Block) ​

A layout container that holds other blocks in a nested grid. Use groups to build multi-column layouts.

blade
@props(['item' => ''])

@if ($item->type == 'group')
<div class="group md:grid gap-6 grid-cols-{{ $item->layoutgrid ?? 12 }}">
    @foreach ($item->children as $child)
        <x-blocks.components :item="$child" />
    @endforeach
</div>
@endif

Accordion ​

A container for collapsible content items. Like the Group block, it acts as a container for child blocks.

blade
@props(['item' => ''])

@if ($item->type == 'accordiongroup')
<div class="accordion">
    @foreach ($item->children as $child)
        <x-blocks.components :item="$child" />
    @endforeach
</div>
@endif

Video ​

A flexible block for displaying videos via oEmbed (YouTube/Vimeo) or local uploads.

FieldTypeDescription
VideovideoLocal video file
PosterposterVideo thumbnail image
oEmbedoembedYouTube or Vimeo URL
blade
@props(['item' => ''])

@if($item->type == 'video')
@php
    $video = get_field('video', $item->datafield);
    $poster = get_field('poster', $item->datafield);
    $oembed = get_field('oembed', $item->datafield);
@endphp

<div class="video-container">
    @if($oembed)
        {{-- Handle oEmbed rendering --}}
        <div class="aspect-video">
            <iframe src="{{ $oembed }}" ...></iframe>
        </div>
    @elseif($video)
        <video controls poster="{{ $poster }}" class="w-full">
            <source src="{{ $video }}" type="video/mp4">
        </video>
    @endif
</div>
@endif

Anchor Menu ​

A navigational menu that links to HTML anchors on the same page.

FieldTypeDescription
NametextDisplay name of the menu
blade
@props(['item' => ''])

@if($item->type == 'anchormenu')
<nav class="anchor-menu">
    {{-- anchor menu logic --}}
</nav>
@endif

Relationship ​

Pulls records from any registered Eloquent model (e.g., Blog posts, Team members).

Configuration lives entirely in block meta. See the Relationship Block documentation.

Built-in Field Types ​

These field types can be used when creating custom blocks:

KeyLabelEdit Widget
textTextInput
wysiwygWYSIWYG EditorEditor
imageImageImage Picker
galleryGalleryGallery Picker
linkLinkInput
true_falsetrue/falseToggle
fileFileFile Upload
colorColorColor Picker
oembedVideo embedYouTube/Vimeo URL

Released under the MIT License.