The FlexibleRender
decorator allows you to quickly render simple text, HTML, or Blade views.
You can create a FlexibleRender
using the static method make()
.
make(Closure|Renderable|string $content, Closure|array $additionalData = [])
use MoonShine\UI\Components\FlexibleRender; FlexibleRender::make('HTML'),// orFlexibleRender::make(view('path_to_blade')),// orFlexibleRender::make(view('path_to_blade', ['data' => 'something'])),// orFlexibleRender::make(view('path_to_blade'), ['data' => 'something']),FlexibleRender::make(view('path_to_blade', ['var1' => 'something 1']), ['var2' => 'something 2']),// orFlexibleRender::make(fn($data) => view('path_to_blade', $data), fn() => ['data' => 'something']),