Basics
The ActionGroup component is designed for the quick grouping of a set of ActionButton instances, as well as for filling the buttons with data.
You can create an ActionGroup using the static method make()
of the ActionGroup
class.
make(iterable $actions = [])
$actions
- a set of ActionButton.
use MoonShine\UI\Components\ActionGroup; ActionGroup::make([ ActionButton::make('Button 1'), ActionButton::make('Button 2'),]);
Filling with Data
To fill all the buttons with data, use the fill()
method and pass a DataWrapperContract:
ActionGroup::make($buttons)->fill($data);
Adding Elements
You can conveniently manipulate the set of ActionButton instances using the add()
, prepend()
, and addMany()
methods:
ActionGroup::make($buttons)->add(ActionButton::make('Button 3'));
ActionGroup::make($buttons)->prepend(ActionButton::make('Button 4'));
ActionGroup::make($buttons)->addMany([ ActionButton::make('Button 5'), ActionButton::make('Button 6'),]);