Skip to content

feat: Formatting toolbar styling scope - #3414

Open
matthewlipski wants to merge 2 commits into
mainfrom
formatting-toolbar-styling-scope
Open

matthewlipski wants to merge 2 commits into
mainfrom
formatting-toolbar-styling-scope

Conversation

@matthewlipski

@matthewlipski matthewlipski commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR changes how styles are applied to formatting toolbar items. Previously, the styles relied on a .bn-toolbar ancestor. While the items are never really rendered outside the formatting toolbar (aside from in tests), we don't really gain anything from this vs giving the items a toolbar-specific class name instead. So this PR changes that:

Old:

.bn-toolbar > .bn-*

New:

.bn-toolbar-*

Rationale

This is a minor change, but a general rule of UI components is they should be as decoupled as possible from other components, and this change helps with that.

Changes

  • Added bn-toolbar-* class names to formatting toolbar items.
  • Updated toolbar item styles to not rely on .bn-toolbar.

Impact

N/A

Testing

Formatting toolbar item component tests have been updated to no longer render the item in a formatting toolbar.

Screenshots/Video

N/A

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

N/A

Summary by CodeRabbit

  • Style
    • Toolbar buttons and dropdowns now use consistent toolbar-specific styling across formatting, link, comment, and file controls.
    • Toolbar styling is consistently applied across supported UI integrations, including Mantine, Shadcn, and Ariakit. Button actions and dropdown behavior remain unchanged.

@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
blocknote Error Error Nov 24, 2026 6:28pm UTC
blocknote-website Error Error Nov 24, 2026 6:28pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64b68f6d-b75a-4c64-b4fe-899328205d30
Commits

Reviewing files that changed from the base of the PR and between dd8bcfb and dd8bcfb.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Toolbar controls and related styles now use toolbar-specific button and select classes across toolkit implementations, React components, and examples. Accessibility tests check individual controls. The editor font-family list is reformatted without changing its values or order.

Changes: Toolbar class scope

Layer / File(s) Summary
Toolkit toolbar classes and styles
packages/ariakit/src/toolbar/*, packages/ariakit/src/style.css, packages/mantine/src/toolbar/*, packages/mantine/src/blocknoteStyles.css, packages/shadcn/src/toolbar/Toolbar.tsx, packages/shadcn/src/style.css
Ariakit, Mantine, and Shadcn toolbar controls add toolbar-specific classes. Related styles target those classes, and select components merge the new classes with supplied classes.
React controls and integrations
packages/react/src/components/Comments/*, packages/react/src/components/FormattingToolbar/DefaultButtons/*, packages/react/src/components/FormattingToolbar/DefaultSelects/*, packages/react/src/components/LinkToolbar/DefaultButtons/*, examples/03-ui-components/11-uppy-file-panel/src/FileReplaceButton.tsx, examples/07-collaboration/05-comments/src/SettingsSelect.tsx, packages/xl-ai/src/components/FormattingToolbar/AIToolbarButton.tsx
React toolbar, link, and comment controls use toolbar-specific classes. Accessibility tests check controls individually. Example and AI toolbar integrations also use the updated classes.

Editor font-list formatting

Layer / File(s) Summary
Font-list formatting
packages/core/src/editor/editor.css
The .bn-default-styles font-family list is reformatted; its values and order are unchanged.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: yousefed, nperez0111

Merge Risk: Minimal · up to dd8bc

This change moves toolbar item styling from ancestor selectors to item-specific classes across the Ariakit, Mantine and Shadcn toolkits and the React components. The built-in and documented custom toolbar items keep their styling, and no concrete regression was found. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat: Formatting toolbar styling scope" matches the main change. The PR moves formatting toolbar item styles from the .bn-toolbar ancestor selector to toolbar-specific bn-toolbar-* clas…
Description check Passed The description explains the change well. It gives the old and new selector patterns and the rationale for decoupling. The Changes and Testing sections are filled in. The Summary section still holds t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat: Formatting toolbar styling scope" matches the main change. The PR moves formatting toolbar item styles from the .bn-toolbar ancestor selector to toolbar-specific bn-toolbar-* classes. The title is short and names the affected area. It does not say the change is a decoupling of styles, but that is a detail the title does not need to carry.

Full details: Description check

Explanation

The description explains the change well. It gives the old and new selector patterns and the rationale for decoupling. The Changes and Testing sections are filled in. The Summary section still holds the template's placeholder comment, and the Rationale section keeps its placeholder comment above the author's text. The Checklist leaves the unit-test and documentation items unchecked. The Impact section says N/A, but the change does alter selectors that other code may depend on. Most required content is present, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps a toolbar key,
New button classes hop in place.
Selects wear their labels neatly,
Tests inspect each control alone.
The font list keeps its order,
Then I nibble clover by the editor.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2e0d04db-b08d-400c-b087-c8440ae8c9ed
Commits

Reviewing files that changed from the base of the PR and between 66f34b9 and dd8bcfb.

Files selected for processing: 38

  • examples/03-ui-components/11-uppy-file-panel/src/FileReplaceButton.tsx
  • examples/07-collaboration/05-comments/src/SettingsSelect.tsx
  • packages/ariakit/src/style.css
  • packages/ariakit/src/toolbar/ToolbarButton.tsx
  • packages/ariakit/src/toolbar/ToolbarSelect.tsx
  • packages/core/src/editor/editor.css
  • packages/mantine/src/blocknoteStyles.css
  • packages/mantine/src/toolbar/ToolbarButton.tsx
  • packages/mantine/src/toolbar/ToolbarSelect.tsx
  • packages/react/src/components/Comments/Comment.tsx
  • packages/react/src/components/Comments/FloatingComposer.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/AddCommentButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/AddTiptapCommentButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/BasicTextStyleButton.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/BasicTextStyleButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/ColorStyleButton.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/ColorStyleButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/CreateLinkButton.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/CreateLinkButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/FileCaptionButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/FileDeleteButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/FileDownloadButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/FilePreviewButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/FileRenameButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/FileReplaceButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/NestBlockButtons.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/NestBlockButtons.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/TableCellMergeButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/TextAlignButton.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/TextAlignButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx
  • packages/react/src/components/LinkToolbar/DefaultButtons/DeleteLinkButton.tsx
  • packages/react/src/components/LinkToolbar/DefaultButtons/EditLinkButton.tsx
  • packages/react/src/components/LinkToolbar/DefaultButtons/OpenLinkButton.tsx
  • packages/shadcn/src/style.css
  • packages/shadcn/src/toolbar/Toolbar.tsx
  • packages/xl-ai/src/components/FormattingToolbar/AIToolbarButton.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@3414

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@3414

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@3414

@blocknote/diagram-block

npm i https://pkg.pr.new/@blocknote/diagram-block@3414

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@3414

@blocknote/math-block

npm i https://pkg.pr.new/@blocknote/math-block@3414

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@3414

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@3414

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@3414

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@3414

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@3414

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@3414

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@3414

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@3414

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@3414

@blocknote/xl-typst-exporter

npm i https://pkg.pr.new/@blocknote/xl-typst-exporter@3414

commit: dd8bcfb

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://TypeCellOS.github.io/BlockNote/pr-preview/pr-3414/

Built to branch gh-pages at 2026-11-24 18:39 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@coderabbitai coderabbitai Bot mentioned this pull request Nov 24, 2026
2 of 4 tasks

@nperez0111 nperez0111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, this is better!

<Components.Generic.Popover.Trigger>
<Components.FormattingToolbar.Button
className={"bn-button"}
className={"bn-toolbar-button"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder whether we should do polymorphism or not & have bn-button & bn-toolbar-button I'm fine with keeping it simple but if for example you wanted a behavior like on hover of any button do some action, then it becomes harder to have to list bn-toolbar-button, bn-menu-button, bn-... etc.

Just a thought, I'm not even pushing for this

This branch had an error being deployed

2 failed deployments
Preview – blocknote — dd8bcfb5 Deployed Nov 24, 2026 by vercel[bot]
Preview – blocknote-website — dd8bcfb5 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants