feat: ActionSeparator for visual dividers between actions#19585
Closed
leek wants to merge 3 commits intofilamentphp:4.xfrom
Closed
feat: ActionSeparator for visual dividers between actions#19585leek wants to merge 3 commits intofilamentphp:4.xfrom
ActionSeparator for visual dividers between actions#19585leek wants to merge 3 commits intofilamentphp:4.xfrom
Conversation
Introduces `ActionSeparator`, a lightweight component that renders a vertical line between actions in header actions, table header actions, and action groups.
Usage:
```php
protected function getHeaderActions(): array
{
return [
ActionGroup::make([...])
->icon('heroicon-o-cog-6-tooth')
->color('gray'),
ActionSeparator::make(),
Action::make('create')
->label('New Record'),
];
}
```
- Extends `ViewComponent` (same base as `Action` and `ActionGroup`)
- Uses `BelongsToGroup` and `CanBeHidden` concerns
- Renders as `<div class="fi-ac-separator">` with CSS styling
- Updates `ActionGroup` to handle `ActionSeparator` in type unions
ActionSeparator for visual dividers between actions
In a dropdown ActionGroup, ActionSeparator now splits the action list into separate `fi-dropdown-list` sections, creating a native visual divider between groups of dropdown items.
Updates the grouping actions docs to document ActionSeparator usage in both inline and dropdown contexts, keeping the existing nested ActionGroup approach as an alternative.
Contributor
|
@leek This is already supported in Filament: https://filamentphp.com/docs/5.x/actions/grouping-actions#adding-dividers-between-actions |
Member
|
Yeah, given the existing syntax in place, I would accept this feature for separating actions without a dropdown, but the syntax would be very different: use Filament\Actions\ActionGroup;
ActionGroup::make([
ActionGroup::make([
// Array of actions
])->dropdown(false),
ActionGroup::make([
// Array of actions
])->dropdown(false),
])->dropdown(false), // Pass this to the outer group too to add separators, maybe?
|
Contributor
Author
This PR is more about the vertical one but always something new to learn! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
ActionSeparator, a lightweight component that renders a visual divider between actions. Works in page header actions, table header actions, and within action groups — adapting its appearance to the context:fi-dropdown-listsections, using the native Filament divider patternUsage
Implementation
ActionSeparatorextendsViewComponent(same base asActionandActionGroup)BelongsToGroupandCanBeHiddenconcerns for visibility control and group nestingisHiddenInGroup()to skip authorization checks (not applicable to separators)<div class="fi-ac-separator">with a CSS hookActionGroup, splits the action list into separatefi-dropdown-listsections (same mechanism that nestedActionGroupuses)ActionGrouptype unions updated to acceptActionSeparatorinactions(),getActions(),toEmbeddedHtml(), andcloneActions()flatActionssince they are visual-only