### Install Mason Package
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Install the Mason package using Composer. Ensure your Filament version is compatible.
```bash
composer require awcodes/mason
```
--------------------------------
### Mason Content Data Structure and Migration
Source: https://context7.com/awcodes/mason/llms.txt
Illustrates the JSON structure Mason uses for storing content and provides a database migration example for a 'pages' table with a 'content' column.
```php
'masonBrick',
'attrs' => [
'id' => 'hero-banner',
'config' => [
'title' => 'Welcome',
'subtitle' => 'Get started today',
'image' => 'heroes/welcome.jpg',
'theme' => 'dark',
],
],
],
[
'type' => 'masonBrick',
'attrs' => [
'id' => 'section',
'config' => [
'background_color' => 'white',
'text' => '
Features
Our amazing features...
',
'image' => null,
],
],
],
[
'type' => 'masonBrick',
'attrs' => [
'id' => 'call-to-action',
'config' => [
'heading' => 'Ready to start?',
'button_text' => 'Sign Up Now',
'button_url' => '/register',
],
],
],
];
// Database migration for content column
Schema::create('pages', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->longText('content')->nullable(); // Use longText for large content
$table->timestamps();
});
```
--------------------------------
### Mason 0.x Database Schema
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Example of the JSON structure for storing Mason bricks in the database in version 0.x.
```json
{
"type":"masonBrick",
"attrs":{
"identifier": "newsletter_signup",
"path": "mason.newsletter-signup",
"values": {
"background_color":"primary",
"heading":"Want product news and updates? Sign up for our newsletter."
}
}
}
```
--------------------------------
### MasonEntry Preview Layout Blade Template
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Example Blade template for a `MasonEntry` component's preview layout. It includes necessary assets and includes the MasonEntry content rendering partial.
```blade
{{ config('app.name') }}
@vite(['resources/css/app.css', 'resources/js/app.js'])
@masonEntryStyles
@include('mason::iframe-entry-content', ['blocks' => $blocks])
```
--------------------------------
### Mason 1.x Database Schema
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Example of the updated JSON structure for storing Mason bricks in the database in version 1.x.
```json
{
"type": "masonBrick",
"attrs": {
"id": "newsletter_signup",
"config": {
"background_color": "primary",
"heading": "Want product news and updates? Sign up for our newsletter."
}
}
}
```
--------------------------------
### Mason Preview Layout Blade Template
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Example Blade template for a Mason field's preview layout. It includes necessary assets and includes the Mason content rendering partial.
```blade
{{ config('app.name') }}
@vite(['resources/css/app.css', 'resources/js/app.js'])
@masonStyles
@include('mason::iframe-preview-content', ['blocks' => $blocks])
```
--------------------------------
### Mason 0.x Component Definition
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Shows how to define Bricks for the Mason component in version 0.x using `Brick::make()` instances.
```php
Mason::make('content')
->bricks([
Section::make(),
])
```
--------------------------------
### Display Mason Brick Actions in a Grid in PHP
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Enable a grid format for displaying brick actions instead of the default list by chaining the `displayActionsAsGrid` method.
```php
Mason::make('content')
->displayActionsAsGrid()
->bricks([...])
```
--------------------------------
### Mason 0.x Brick Creation
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Illustrates the fluent API approach used in Mason 0.x for creating custom Bricks by extending Filament's action class.
```php
use Awcodes\Mason\Brick;
use Awcodes\Mason\EditorCommand;
use Awcodes\Mason\Mason;
Brick::make('section')
->label('Section')
->form([
// ...
])
->action(function (array $arguments, array $data, Mason $component) {
$component->runCommands(
[
new EditorCommand(
name: 'setBrick',
arguments: [[
'identifier' => 'section',
'values' => $data,
'path' => 'mason::bricks.section',
'view' => view('mason::bricks.section', $data)->toHtml(),
]],
),
],
editorSelection: $arguments['editorSelection'],
);
});
```
--------------------------------
### Mason Configuration File
Source: https://context7.com/awcodes/mason/llms.txt
Customize Mason's namespace, view paths, preview layouts, entry layouts, and route middleware in the configuration file.
```php
return [
'generator' => [
'namespace' => 'App\\Mason', // Namespace for generated bricks
'views_path' => 'mason', // Path for brick views
],
'preview' => [
'layout' => 'mason::iframe-preview', // Preview layout view
],
'entry' => [
'layout' => 'mason::iframe-entry', // Entry layout view
],
'routes' => [
'middleware' => ['web', 'auth'], // Route middleware
],
];
```
--------------------------------
### Publish Mason Configuration
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Publish the Mason configuration file to customize settings like namespaces, view paths, and middleware.
```bash
php artisan vendor:publish --tag="mason-config"
```
--------------------------------
### MasonEntry Infolist Component Configuration
Source: https://context7.com/awcodes/mason/llms.txt
Configure the MasonEntry infolist component to display Mason content in a read-only iframe, specifying available bricks and custom layout views.
```php
schema([
MasonEntry::make('content')
->bricks([
Section::class,
HeroBrick::class,
CardsBrick::class,
])
// Custom entry layout view
->previewLayout('layouts.mason-entry')
// Custom height for display
->extraInputAttributes(['style' => 'min-height: 30rem;'])
->columnSpanFull(),
]);
}
}
```
--------------------------------
### Use Brick Collections in Forms, Infolists, and Rendering
Source: https://context7.com/awcodes/mason/llms.txt
Demonstrates how to apply predefined brick collections when creating Mason fields in forms, infolists, or when rendering content on the frontend.
```php
bricks(BrickCollection::make());
// Usage in infolist
MasonEntry::make('content')
->bricks(BrickCollection::make());
// Usage in frontend rendering
{!! mason($page->content, BrickCollection::make())->toHtml() !!}
```
--------------------------------
### Render Content with MasonRenderer
Source: https://context7.com/awcodes/mason/llms.txt
Use the global helper function for quick rendering or instantiate MasonRenderer directly for more control over output formats like HTML, unsanitized HTML, plain text, or raw array structure.
```php
content, [
\App\Mason\HeroBrick::class,
\App\Mason\CardsBrick::class,
\App\Mason\Section::class,
])->toHtml();
// Using MasonRenderer directly for more control
$renderer = MasonRenderer::make($page->content)
->bricks([
\App\Mason\HeroBrick::class,
\App\Mason\CardsBrick::class,
\App\Mason\Section::class,
]);
// Sanitized HTML (safe for output)
$safeHtml = $renderer->toHtml();
// Unsanitized HTML (for trusted contexts only)
$rawHtml = $renderer->toUnsafeHtml();
// Plain text without HTML tags
$plainText = $renderer->toText();
// Get raw array structure
$blocks = $renderer->toArray();
```
```blade
{{-- In a Blade view --}}
{!! mason($page->content, \App\Mason\BrickCollection::make())->toHtml() !!}
```
--------------------------------
### Mason 1.x Component Definition
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Illustrates the updated way to define Bricks for the Mason component in version 1.x, using class strings.
```php
Mason::make('content')
->bricks([
Section::class,
])
```
--------------------------------
### Run All Tests
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Execute all tests including refactor check, lint check, and unit tests.
```bash
composer test
```
--------------------------------
### Mason Upgrade Command
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Command to execute the brick migration process in Mason 1.x.
```bash
php artisan mason:upgrade-bricks
```
--------------------------------
### Render Mason Content to HTML
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Use the `mason()` helper function to render stored content to HTML. Pass the content and a collection of available bricks to the helper. This method helps keep your rendering logic DRY.
```php
{!! mason(content: $post->content, bricks: \App\Mason\BrickCollection::make())->toHtml() !!}
```
--------------------------------
### Use MasonEntry in Filament Infolists
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Integrate Mason content into Filament infolists using the `MasonEntry` component. Ensure to provide the field name and available bricks.
```php
use Awcodes\Mason\MasonEntry;
use Awcodes\Mason\Bricks\Section;
->schema([
MasonEntry::make('content')
->bricks([
Section::class,
]),
])
```
--------------------------------
### Default Mason Configuration
Source: https://github.com/awcodes/mason/blob/3.x/README.md
The default configuration for the Mason package, covering generator settings, preview and entry layouts, and route middleware.
```php
return [
'generator' => [
'namespace' => 'App\\Mason',
'views_path' => 'mason',
],
'preview' => [
'layout' => 'mason::iframe-preview',
],
'entry' => [
'layout' => 'mason::iframe-entry',
],
'routes' => [
'middleware' => ['web', 'auth'],
],
];
```
--------------------------------
### Static Divider Brick Implementation
Source: https://context7.com/awcodes/mason/llms.txt
Creates a static Divider brick that inserts immediately without a configuration form by hiding the modal. It defines an ID, icon, and renders a simple view.
```php
render();
}
// Hide the modal - brick inserts immediately
public static function configureBrickAction(Action $action): Action
{
return $action->modalHidden();
}
}
```
--------------------------------
### Set MasonEntry Preview Layout
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Configure the preview layout for a `MasonEntry` component to ensure consistent styling within Filament infolists. This mirrors the functionality for regular Mason fields.
```php
MasonEntry::make('content')
->previewLayout('layouts.mason-entry')
->bricks([...])
```
--------------------------------
### Scaffold New Brick
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Generate a new brick class and its associated view templates.
```bash
php artisan make:mason-brick {Name}
```
--------------------------------
### Enable User Sorting of Bricks in Mason Editor (Descending)
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Configure the Mason editor to allow users to sort bricks in descending order (Z-A) by label using the `sortBricks` method with the 'desc' argument.
```php
// Sort descending (Z-A) by label
Mason::make('content')
->sortBricks('desc')
->bricks([...])
```
--------------------------------
### Enable User Sorting of Bricks in Mason Editor (Ascending)
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Allow users to sort bricks directly within the editor by label. The `sortBricks` method defaults to ascending order if no argument is provided or if 'asc' is specified.
```php
// Sort ascending (A-Z) by label
Mason::make('content')
->sortBricks('asc')
->bricks([...])
// Or simply (defaults to 'asc')
Mason::make('content')
->sortBricks()
->bricks([...])
```
--------------------------------
### Fake Mason Content for Testing
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Use the `Faker` class to generate mock Mason content for testing. You can specify brick IDs and their configurations to simulate different content structures.
```php
use Awcodes\Mason\Support\Faker;
Faker::make()
->brick(
id: 'section',
config: [
'background_color' => 'white',
'text' => '
',
'image' => null,
]
)
->asJson(),
```
--------------------------------
### Create a New Brick
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Use the `make:mason-brick` Artisan command to generate a new brick class and its associated Blade templates. This command sets up the basic structure in the configured paths.
```bash
php artisan make:mason-brick Section
```
--------------------------------
### Define Custom Brick Collections in PHP
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Create a static method to return an array of brick classes for reuse. This helps in organizing and assigning bricks to both the editor and entry fields.
```php
class BrickCollection
{
public static function make(): array
{
return [
NewsletterSignup::class,
Section::class,
Cards::class,
SupportCenter::class,
];
}
}
Mason::make('content')
->bricks(BrickCollection::make())
MasonEntry::make('content')
->bricks(BrickCollection::make())
```
--------------------------------
### Run Rector Refactoring
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Apply automated refactoring using Rector.
```bash
composer refactor
```
--------------------------------
### Generate New Brick Class
Source: https://context7.com/awcodes/mason/llms.txt
Use the Artisan command to scaffold a new brick class and its associated Blade view. You can specify a nested namespace and force overwrite existing files.
```bash
php artisan make:mason-brick HeroBanner
```
```bash
php artisan make:mason-brick Marketing/CallToAction
```
```bash
php artisan make:mason-brick HeroBanner --force
```
--------------------------------
### Create Static Bricks without Data or Forms in PHP
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Implement static bricks by returning a view directly in `toHtml` and hiding the modal configuration using `modalHidden` in `configureBrickAction`. This adds the brick without user input.
```php
public static function toHtml(array $config, ?array $data = null): ?string
{
return view('mason.static-brick');
}
public static function configureBrickAction(Action $action): Action
{
return $action->modalHidden();
}
```
--------------------------------
### Render Mason Content with Full API
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Utilize the full MasonRenderer API to convert stored JSON content to HTML.
```php
// Full renderer API
MasonRenderer::make($content)->bricks($bricks)->toHtml()
```
--------------------------------
### Generate Test Content with Faker
Source: https://context7.com/awcodes/mason/llms.txt
Use the Faker class to programmatically build Mason brick structures for testing. Output the generated content as a JSON array, HTML, or plain text.
```php
brick(
id: 'hero-banner',
config: [
'title' => 'Welcome to Our Site',
'subtitle' => 'Discover amazing features',
'image' => 'heroes/test-image.jpg',
'cta_text' => 'Get Started',
'cta_url' => '/signup',
'theme' => 'dark',
'overlay' => true,
]
)
->brick(
id: 'section',
config: [
'background_color' => 'white',
'text' => '
',
'image' => 'sections/contact.jpg',
]
)
->asJson(); // Returns array structure for database
// In a factory
class PageFactory extends Factory
{
public function definition(): array
{
return [
'title' => fake()->sentence(),
'slug' => fake()->slug(),
'content' => Faker::make()
->brick('hero-banner', [
'title' => fake()->sentence(),
'subtitle' => fake()->paragraph(),
'theme' => fake()->randomElement(['light', 'dark']),
])
->brick('section', [
'background_color' => 'white',
'text' => fake()->paragraphs(3, true),
])
->asJson(),
];
}
}
// Get as HTML for assertions
$html = Faker::make()
->brick('section', ['text' => '
Test content
'])
->asHtml();
// Get as plain text
$text = Faker::make()
->brick('section', ['text' => '
Test content
'])
->asText();
```
--------------------------------
### Mason 1.x Brick Class Structure
Source: https://github.com/awcodes/mason/blob/3.x/UPGRADE.md
Demonstrates the new class-based structure for custom Bricks in Mason 1.x, extending the `Awcodes\Mason\Brick` class.
```php
use Awcodes\Mason\Brick;
use Filament\Actions\Action;
class Section extends Brick
{
public static function getId(): string
{
return 'section';
}
public static function toHtml(array $config, array $data): ?string
{
return view('mason::bricks.section.index', $config)->render();
}
public static function configureBrickAction(Action $action): Action
{
return $action
->slideOver()
->schema([
// ...
]);
}
}
```
--------------------------------
### Mason Content Renderer
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Utilize the `MasonRenderer` class for more granular control over content rendering. You can convert the content to HTML, unsafe HTML, an array, or plain text.
```php
use Awcodes\Mason\Support\MasonRenderer;
$renderer = MasonRenderer::make($content)->bricks(\App\Mason\BrickCollection::make());
$renderer->toHtml()
$renderer->toUnsafeHtml();
$renderer->toArray();
$renderer->toText();
```
--------------------------------
### Run Single Test File
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Execute tests within a specific file.
```bash
./vendor/bin/pest tests/src/FieldTest.php
```
--------------------------------
### Render Mason Content to HTML
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Use the helper function to render stored Mason JSON content to HTML.
```php
// Helper function
mason($content, $bricks)->toHtml()
```
--------------------------------
### Enable Color Mode Toggle and Set Default in Mason Editor (PHP)
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Add a color mode toggle button to the editor sidebar and set the initial default mode using `colorModeToggle` and `defaultColorMode` methods. The `defaultColorMode` sets the initial state, but user preferences are saved in local storage.
```php
Mason::make('content')
->colorModeToggle()
->defaultColorMode('dark')
->bricks([...])
```
--------------------------------
### Define Reusable Brick Collections
Source: https://context7.com/awcodes/mason/llms.txt
Create static methods within a class to define reusable collections of bricks for different contexts like forms, entries, or frontend rendering. This ensures consistency and prevents repetition.
```php
$config['title'] ?? '',
'subtitle' => $config['subtitle'] ?? '',
'image' => $config['image'] ?? null,
'cta_text' => $config['cta_text'] ?? null,
'cta_url' => $config['cta_url'] ?? null,
'theme' => $config['theme'] ?? 'light',
'overlay' => $config['overlay'] ?? false,
])->render();
}
// Configure the edit form for this brick
public static function configureBrickAction(Action $action): Action
{
return $action
->slideOver() // Open form in slide-over panel
->schema([
TextInput::make('title')
->required()
->maxLength(100),
TextInput::make('subtitle')
->maxLength(200),
FileUpload::make('image')
->image()
->directory('heroes'),
Grid::make(2)->schema([
TextInput::make('cta_text')
->label('Button Text'),
TextInput::make('cta_url')
->label('Button URL')
->url(),
]),
Select::make('theme')
->options([
'light' => 'Light',
'dark' => 'Dark',
'primary' => 'Primary',
])
->default('light'),
Toggle::make('overlay')
->label('Show dark overlay on image'),
]);
}
}
```
--------------------------------
### Set Mason Field Preview Layout
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Configure the preview layout for a Mason field to ensure consistent styling between the editor and the front end. This is useful when different fields require distinct layouts.
```php
Mason::make('content')
->previewLayout('layouts.mason-preview') // your app's layout
->bricks([...])
```
--------------------------------
### Run Unit Tests
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Execute only unit tests with parallel execution enabled.
```bash
composer test:unit
```
--------------------------------
### Add Mason CSS to Theme
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Import the plugin's CSS and Blade views into your custom Filament theme or app's CSS file.
```css
@import '../../../../vendor/awcodes/mason/resources/css/plugin.css';
@source '../../../../vendor/awcodes/mason/resources/**/*.blade.php';
```
--------------------------------
### Add Mason CSS to Filament Theme
Source: https://context7.com/awcodes/mason/llms.txt
Import Mason's plugin CSS and Blade views into your Filament admin theme's CSS file.
```css
@import '../../../../vendor/awcodes/mason/resources/css/plugin.css';
@source '../../../../vendor/awcodes/mason/resources/**/*.blade.php';
```
--------------------------------
### Check Code Style
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Check code style without applying automatic fixes.
```bash
composer test:lint
```
--------------------------------
### Mason Form Field Configuration
Source: https://context7.com/awcodes/mason/llms.txt
Configure the Mason form field in a Filament resource, defining available bricks, custom preview layouts, sidebar position, display options, sorting, editing behavior, color mode, and height.
```php
schema([
Mason::make('content')
->bricks([
Section::class,
HeroBrick::class,
CardsBrick::class,
TestimonialBrick::class,
])
// Custom preview layout with your app's styles
->previewLayout('layouts.mason-preview')
// Position sidebar on left instead of right
->sidebarPosition(SidebarPosition::Start)
// Display brick actions as grid instead of list
->displayActionsAsGrid()
// Sort bricks alphabetically by label
->sortBricks('asc')
// Enable double-click to edit bricks
->doubleClickToEdit()
// Enable light/dark mode toggle
->colorModeToggle()
->defaultColorMode('light')
// Custom height for the editor
->extraInputAttributes(['style' => 'min-height: 40rem;'])
->columnSpanFull(),
]);
}
}
```
--------------------------------
### Brick Class Definition
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Defines a custom brick class extending `AwcodesMasonBrick`. It includes methods for setting the ID, label, icon, rendering HTML content, and configuring the brick's schema for the editor.
```php
use Awcodes\Mason\Brick;
use Filament\Actions\Action;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\ToggleButtons;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section as FilamentSection;
use Filament\Support\Icons\Heroicon;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HtmlString;
use Throwable;
class Section extends Brick
{
public static function getId(): string
{
return 'section';
}
public static function getLabel(): string
{
return parent::getLabel();
}
public static function getIcon(): string | Heroicon | Htmlable | null
{
return new HtmlString('');
}
/**
* @throws Throwable
*/
public static function toHtml(array $config, ?array $data = null): ?string
{
return view('mason::bricks.section.index', [
'background_color' => $config['background_color'] ?? 'white',
'image' => $config['image'] ?? null,
'text' => $config['text'] ?? null,
])->render();
}
public static function configureBrickAction(Action $action): Action
{
return $action
->slideOver()
->schema([
Radio::make('background_color'),
FileUpload::make('image'),
RichEditor::make('text'),
]);
}
}
```
--------------------------------
### Run Specific Test
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Execute a test identified by its name filter.
```bash
./vendor/bin/pest --filter "test name"
```
--------------------------------
### Mason Preview Layout Blade View
Source: https://context7.com/awcodes/mason/llms.txt
Use this Blade layout for the editor preview. It includes Mason's required styles and allows for custom CSS overrides.
```blade
{{-- resources/views/layouts/mason-preview.blade.php --}}
{{ config('app.name') }} - Preview
@vite(['resources/css/app.css', 'resources/js/app.js'])
@masonStyles
@include('mason::iframe-preview-content', ['blocks' => $blocks])
```
--------------------------------
### Enable Double-Click Editing for Mason Fields
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Enable the double-click to edit functionality for Mason fields. This provides a quicker way to access the edit modal for bricks.
```php
Mason::make('content')
->doubleClickToEdit()
->bricks([...])
```
--------------------------------
### Customize Mason Route Middleware
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Customize the middleware used for Mason's internal routes by updating the 'routes.middleware' option in the published config file. This is useful for custom authentication guards.
```php
'routes' => [
'middleware' => ['web', 'auth:admin'],
],
```
--------------------------------
### Fix Code Style
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Automatically fix code style issues based on configured rules.
```bash
composer lint
```
--------------------------------
### Customize Mason Field and Entry Height
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Adjust the minimum height of the Mason editor or entry component using Filament's `extraInputAttributes` method. This allows for more vertical space as needed.
```php
Mason::make('content')
->extraInputAttributes(['style' => 'min-height: 30rem;'])
->bricks([...])
```
```php
MasonEntry::make('content')
->extraInputAttributes(['style' => 'min-height: 40rem;'])
->bricks([...])
```
--------------------------------
### Configure CSS for Dark Mode Variants
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Define custom variants for dark mode in CSS to support manual color mode toggling within the application.
```css
@custom-variant dark (&:where(.dark, .dark *));
```
--------------------------------
### Mason Entry Layout Blade View
Source: https://context7.com/awcodes/mason/llms.txt
This Blade layout is for rendering Mason content on public-facing pages. It includes necessary application assets and Mason's entry styles.
```blade
{{-- resources/views/layouts/mason-entry.blade.php --}}
{{ config('app.name') }} - Entry
@vite(['resources/css/app.css', 'resources/js/app.js'])
@masonEntryStyles
@include('mason::iframe-entry-content', ['blocks' => $blocks])
```
--------------------------------
### Model with JSON Cast for Mason Content
Source: https://context7.com/awcodes/mason/llms.txt
Ensure the database column storing Mason content is cast as 'array' or 'json' in your Eloquent model.
```php
'array', // Required for Mason to work
];
}
```
--------------------------------
### Check Rector Refactoring
Source: https://github.com/awcodes/mason/blob/3.x/CLAUDE.md
Check for potential refactoring changes without applying them.
```bash
composer test:refactor
```
--------------------------------
### Customize Mason Editor Colors
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Override default Mason editor colors using CSS variables. Apply these styles in your application's main CSS file to match your design.
```css
#mason-preview-container {
--mason-border-color: rgb(236, 72, 153);
--mason-controls-background: rgba(0, 0, 0, 0.8);
--mason-button-hover-background: rgba(255, 255, 255, 0.2);
--mason-drop-zone-background: rgba(236, 72, 153, 0.5);
}
```
--------------------------------
### Hero Banner Blade View
Source: https://context7.com/awcodes/mason/llms.txt
Blade template for the Hero Banner brick, rendering content based on configuration including title, subtitle, image, CTA, theme, and overlay.
```blade
{{-- resources/views/mason/hero-banner.blade.php --}}
@if($image)
```
--------------------------------
### Position Mason Editor Sidebar to the Left in PHP
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Change the default right-aligned sidebar position to the left by using the `sidebarPosition` method with `SidebarPosition::Start`.
```php
use Awcodes\Mason\Enums\SidebarPosition;
Mason::make('content')
->sidebarPosition(SidebarPosition::Start)
->bricks([...])
```
--------------------------------
### Mason Form Field Usage
Source: https://github.com/awcodes/mason/blob/3.x/README.md
Integrate the Mason component into your Filament forms. The 'content' field requires an array of available 'bricks'. Ensure your model casts this field to 'array' or 'json'.
```php
use Awcodes\Mason\Mason;
use Awcodes\Mason\Bricks\Section;
->schema([
Mason::make('content')
->bricks([
Section::class,
]),
])
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.