© 2026 Hedgehog Software, LLC
class TagsManagerComponent extends Component implements HasForms, HasTable { use InteractsWithForms; use InteractsWithTable; public function mount(): void { $this->form->fill(); } public function makeForm(): Form { return Form::make($this)->schema([ TextInput::make('name')->required()->maxLength(255), ColorPicker::make('color')->required(), Select::make('input_1') ->options([ 'draft' => 'Draft', 'reviewing' => 'Reviewing', 'published' => 'Published', ]) ->live() ->required(), TextInput::make('input_2') ->label('2') ->maxLength(255) ->visible(function (Get $get) { $input = $get('input_1'); return $input !== null && $input !== 'draft' && $input !== 'reviewing'; }), ]); } public function table(Table $table): Table { return $table ->query(Tag::query()) ->columns([ TextColumn::make('name')->searchable()->sortable(), ColorColumn::make('color')->searchable()->sortable(), TextColumn::make('input_1')->searchable()->sortable(), TextColumn::make('input_2')->searchable()->sortable(), ]) ->headerActions([ Action::make('create')->label('Add Tag')->form($this->makeForm()->getComponents()), ]) ->paginated([10, 25, 50, 100, 'all']); } public function render() { return view('livewire.tags-manager-component'); } }
{{ $this->table }}
$this->makeForm()->getComponents()
makeForm()
private static function getFormComponents(?params): array { return [ TextInput::make(), ... ]; }