File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -159,3 +159,28 @@ ButtonGroupColumn::make('Actions')
159
159
}),
160
160
]),
161
161
```
162
+
163
+ ## Component Columns
164
+
165
+ Component columns let you specify a component name and attributes and provides the column value to the slot.
166
+
167
+ ``` php
168
+ // Before
169
+ Column::make("Email", "email")
170
+ ->format(function ($value) {
171
+ return view('components.alert')
172
+ ->with('attributes', new ComponentAttributeBag([
173
+ 'type' => Str::endsWith($value, 'example.org') ? 'success' : 'danger',
174
+ 'dismissible' => true,
175
+ ]))
176
+ ->with('slot', $value);
177
+ }),
178
+
179
+ // After
180
+ ComponentColumn::make('E-mail', 'email')
181
+ ->component('email')
182
+ ->attributes(fn ($value, $row, Column $column) => [
183
+ 'type' => Str::endsWith($value, 'example.org') ? 'success' : 'danger',
184
+ 'dismissible' => true,
185
+ ]),
186
+ ```
You can’t perform that action at this time.
0 commit comments