Skip to content

feat: add dropdown toolbar buttons to Rich Editor#19278

Open
leek wants to merge 9 commits intofilamentphp:4.xfrom
leek:feat/rich-editor-dropdown-toolbar-buttons
Open

feat: add dropdown toolbar buttons to Rich Editor#19278
leek wants to merge 9 commits intofilamentphp:4.xfrom
leek:feat/rich-editor-dropdown-toolbar-buttons

Conversation

@leek
Copy link
Contributor

@leek leek commented Feb 16, 2026

image image

Summary

  • Add dropdown toolbar buttons to group related tools (alignment, headings, etc.) into compact menus via associative array syntax in toolbarButtons() or by registering RichEditorDropdownTool instances in tools()
  • RichEditorDropdownTool supports icon mode (inline row of icons) and select mode (vertical list with labels)
  • Dropdown configs resolve from associative entries with proper cache invalidation and disable support — disabling options collapses a single-option dropdown back to a plain button; disabling the trigger removes the entire dropdown
  • Add paragraph tool to core Rich Editor tools
  • Add ARIA roles for accessibility (menu, menuitem, aria-haspopup)
  • Add documentation for dropdown toolbar buttons and the paragraph tool

Test plan

  • 12 new Pest tests covering dropdown creation, option disabling, collapse-to-plain-button, trigger removal, hasToolbarButton() for dropdown options, cache invalidation, and group interop
  • All 34 Rich Editor tests pass (vendor/bin/pest tests/src/Forms/Components/RichEditorTest.php)
  • PHPStan passes with no errors
  • Code style fixes applied (composer cs)

leek added 3 commits February 16, 2026 09:19
Enable grouping related tools (alignment, headings, etc.) into compact
dropdown menus via associative array syntax in `toolbarButtons()` or by
registering `RichEditorDropdownTool` instances in `tools()`.

- Add `RichEditorDropdownTool` class with icon mode and select mode
- Update `InteractsWithToolbarButtons` to resolve dropdown configs from
  associative entries, with proper cache invalidation and disable support
- Add `paragraph` tool to core Rich Editor tools
- Add dropdown CSS classes with dark mode support
- Add ARIA roles for accessibility (menu, menuitem, aria-haspopup)
- Add Alpine `dropdownOpen` state for managing open/close
- Add 12 new Pest tests covering dropdown behavior
…tate

- Use per-dropdown x-data/x-effect instead of shared parent dropdownOpen state
- Split rendering into separate toIconDropdownHtml() and toSelectHtml() methods
- Add Closure support for options
- Restore getExtraAttributeBag() on trigger buttons and add aria-label
- Use x-html/x-text with IIFE effects for reactive trigger updates
- Improve chevron SVG with rounded stroke caps
- Add focus-visible styles to trigger and option buttons
- Remove dropdownOpen from Alpine JS component
Add static closure, backtick code references in comments, document
dropdown toolbar buttons and paragraph tool, apply code style fixes.
@leek leek marked this pull request as ready for review February 17, 2026 14:02
leek and others added 4 commits February 17, 2026 09:02
…tons

Allows users to switch dropdown toolbar buttons from icon mode to
select mode (text labels) using the shorthand syntax, without needing
to manually construct `RichEditorDropdownTool` instances.
@leek leek changed the title Add dropdown toolbar buttons to Rich Editor feat: add dropdown toolbar buttons to Rich Editor Feb 17, 2026
@danharrin danharrin added enhancement New feature or request pending review labels Feb 19, 2026
@danharrin danharrin added this to the v4 milestone Feb 19, 2026
Copy link
Member

@danharrin danharrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refactor the implementation to use an object, such as ToolbarButtonGroup, to configure the groups instead of nested arrays. You could introduce a textualButtons() config method on that object instead of introducing selectModeDropdowns() for the entire editor.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Roadmap Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending changes

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants