File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -382,6 +382,47 @@ class ExampleListPage extends AbstractListViewPage
382382}
383383```
384384
385+ ## Primary Button
386+
387+ A primary button can be displayed in the list view header using the ` ListViewPrimaryButton ` class.
388+ It supports two modes: a link that navigates to a URL, or a button that triggers an action via a CSS class.
389+
390+ ### Link Button
391+
392+ ``` php
393+ class ExampleListView extends AbstractListView
394+ {
395+ public function __construct()
396+ {
397+ $this->setPrimaryButton(
398+ ListViewPrimaryButton::forLink(
399+ 'wcf.example.add',
400+ FontAwesomeIcon::fromValues('plus'),
401+ LinkHandler::getInstance()->getControllerLink(ExampleAddForm::class),
402+ )
403+ );
404+ }
405+ }
406+ ```
407+
408+ ### Action Button
409+
410+ ``` php
411+ class ExampleListView extends AbstractListView
412+ {
413+ public function __construct()
414+ {
415+ $this->setPrimaryButton(
416+ ListViewPrimaryButton::forButton(
417+ 'wcf.example.add',
418+ FontAwesomeIcon::fromValues('plus'),
419+ 'exampleAddButton',
420+ )
421+ );
422+ }
423+ }
424+ ```
425+
385426## Events
386427
387428Existing list views can be modified using events.
You can’t perform that action at this time.
0 commit comments