Skip to content

Add inline Code to the default formatting toolbar - #3423

Open
nperez0111 wants to merge 1 commit into
side-menu-styling-scopefrom
add-toolbar-code-style-toggle-3367
Open

nperez0111 wants to merge 1 commit into
side-menu-styling-scopefrom
add-toolbar-code-style-toggle-3367

Conversation

@nperez0111

@nperez0111 nperez0111 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add Code after Strike in the default formatting toolbar so users can toggle inline code on selected text without a shortcut. This reuses the existing BasicTextStyleButton; the inline code style itself is unchanged.

image

Fixes #3367. Stacked on #3415.

Changes

  • Add the existing inline Code button to the default controls.
  • Update the toolbar docs, keyboard traversal expectations, and affected mobile screenshots.

Testing

  • Confirmed the new default-toolbar regression test fails without the button and passes with it.
  • FormattingToolbar and BasicTextStyleButton browser suites: 132 passed across Chromium, Firefox, and WebKit.
  • Targeted toolbar visual tests: 15 passed across the same browsers.
  • Lint, formatting, and docs link validation passed.

Summary by CodeRabbit

  • New Features
    • Added a Code button to the default formatting toolbar for applying inline code styling.
  • Documentation
    • Updated the formatting toolbar demo description to reflect the Code button and its behavior.

@vercel

vercel Bot commented Nov 26, 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 26, 2026 10:46am UTC
blocknote-website Error Error Nov 26, 2026 10:46am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The default formatting toolbar now includes a Code button. Browser tests cover inline code formatting toggling and keyboard navigation. The demo description reflects the updated toolbar.

Changes: Formatting Toolbar

Layer / File(s) Summary
Add and verify the Code button
packages/react/src/components/FormattingToolbar/FormattingToolbar.tsx, packages/react/src/components/FormattingToolbar/FormattingToolbar.browser.test.tsx, docs/content/docs/react/components/formatting-toolbar.mdx
The default toolbar adds a Code button. Tests cover applying and removing inline code formatting, its pressed state, and keyboard focus order. The demo description is updated.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature · Severity of issue fixed: Low

Possibly related issues

  • TypeCellOS/BlockNote issue 3367 reports that inline code formatting cannot be applied through the toolbar. This change adds the Code button to the default toolbar.

Suggested reviewers: matthewlipski

Merge Risk: Minimal · up to 60ae8 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: adding the inline Code button to the default formatting toolbar. The raw summary confirms this change in FormattingToolbar.tsx, with matching test and docs updates. 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.
Description check Passed The description follows the repository template. It has a Summary that states the change: the existing Code button is added after Strike in the default formatting toolbar. It has Changes, a Testing se…
Full details: Title check

Explanation

The title states the main change: adding the inline Code button to the default formatting toolbar. The raw summary confirms this change in FormattingToolbar.tsx, with matching test and docs updates. The title is specific and concise.

Full details: Description check

Explanation

The description follows the repository template. It has a Summary that states the change: the existing Code button is added after Strike in the default formatting toolbar. It has Changes, a Testing section with specific results across three browsers, and a screenshot. It also links the issue (#3367) and the stacked PR (#3415). Missing or weak items: the Rationale, Impact, and Additional Notes sections are absent. The Checklist is also absent. The Testing section names no unit test file, but it does name a regression test. Overall, the description is mostly complete, 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 the Code button bright,
“Fetch” turns mono, then returns right.
The focus hops through rows in turn,
One more toolbar key to learn.
Blue hues stay, while code marks shine.
The rabbit nibbles, pleased with the line.

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: 8ea4681d-575e-4e85-bbfa-9e1523aea51d
Commits

Reviewing files that changed from the base of the PR and between 1108309 and 60ae82e.

Files ignored due to path filters: 3

  • tests/src/end-to-end/portals/__screenshots__/shadowDOM.test.tsx/shadow-dom-mobile-toolbar-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/portals/__screenshots__/shadowDOM.test.tsx/shadow-dom-mobile-toolbar-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/portals/__screenshots__/shadowDOM.test.tsx/shadow-dom-mobile-toolbar-webkit-linux.png is excluded by !**/*.png
Files selected for processing: 3

  • docs/content/docs/react/components/formatting-toolbar.mdx
  • packages/react/src/components/FormattingToolbar/FormattingToolbar.browser.test.tsx
  • packages/react/src/components/FormattingToolbar/FormattingToolbar.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 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

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

@blocknote/code-block

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

@blocknote/core

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

@blocknote/diagram-block

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

@blocknote/mantine

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

@blocknote/math-block

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

@blocknote/react

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

@blocknote/server-util

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

@blocknote/shadcn

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

@blocknote/xl-ai

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

@blocknote/xl-docx-exporter

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

@blocknote/xl-email-exporter

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

@blocknote/xl-multi-column

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

@blocknote/xl-odt-exporter

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

@blocknote/xl-pdf-exporter

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

@blocknote/xl-typst-exporter

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

commit: 60ae82e

@github-actions

github-actions Bot commented Nov 26, 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-3423/

Built to branch gh-pages at 2026-11-26 14:20 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@nperez0111

Copy link
Copy Markdown
Contributor Author

@matthewlipski & @YousefED, could you explain why we did not already have this? Was it an oversight or intentional?

@YousefED

Copy link
Copy Markdown
Collaborator

@matthewlipski & @YousefED, could you explain why we did not already have this? Was it an oversight or intentional?

No reason I'm aware of. Could be that other apps like notion also didnt use to have this, but not sure. so let's go!

This branch had an error being deployed

2 failed deployments
Preview – blocknote — 60ae82e5 Deployed Nov 26, 2026 by vercel[bot]
Preview – blocknote-website — 60ae82e5 Deployed Nov 26, 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.

Monospaced font not available via toolbar

3 participants