Skip to content

Conversation

@sahiee-dev
Copy link
Contributor

@sahiee-dev sahiee-dev commented Jan 17, 2026

Reduce rich text tab width to 2 spaces

This PR reduces the visual width of tab characters (\t) in text and rich text shapes from the browser default (~8 spaces) to 2 spaces, making indentation more compact and practical for notes and code-like content.

What changed

  • Add --tl-tab-size CSS custom property to .tl-container for theming and configurability
  • Apply tab-size: var(--tl-tab-size, 2) to:
    • .tl-text (plain text shapes)
    • .tl-rich-text .ProseMirror (rich text editor)
  • Tabs now render at 2-space width instead of the browser default

Before / After

Before (browser default tab width ~8 spaces)
Screenshot 2026-01-17 at 7 38 44 PM

After (tab-size = 2 spaces)
Screenshot 2026-01-17 at 7 40 17 PM

This is a visual-only improvement; text data remains unchanged.


Change type

  • bugfix
  • improvement
  • feature
  • api
  • other

Test plan

  1. Create a text or note shape
  2. Press Tab to insert indentation
  3. Verify the tab renders at approximately 2 spaces
  4. Repeat in a rich text shape (notes / labels)
  5. Confirm text measurement and resizing behave normally
  • Unit tests
  • End to end tests

Release notes

  • Improved tab indentation in text and rich text shapes by reducing tab width to 2 spaces

fixes #7703


Note

Low Risk
Low risk: this is a visual-only styling change affecting how tab characters render in text/rich-text editing and SVG export, with no data-model or behavior changes.

Overview
Tab characters now render with a 2-space width instead of the browser default by introducing --tl-tab-size on .tl-container.

This applies tab-size: var(--tl-tab-size, 2) to .tl-text and .tl-rich-text .ProseMirror, and sets tabSize in RichTextLabel’s SVG export styling so exported rich text matches on-canvas rendering.

Written by Cursor Bugbot for commit dea295c. This will update automatically on new commits. Configure here.

- Add --tl-tab-size CSS custom property to .tl-container for theming
- Apply tab-size: var(--tl-tab-size, 2) to .tl-text and .tl-rich-text .ProseMirror
- Makes tabs render at 2 space widths instead of browser default (8)
@huppy-bot huppy-bot bot added the feature New feature label Jan 17, 2026
@vercel
Copy link

vercel bot commented Jan 17, 2026

@sahiee-dev is attempting to deploy a commit to the tldraw Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Ensures tabs render at 2-space width in SVG exports, matching the CSS
behavior in the app.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Changed from hardcoded '2' to 'var(--tl-tab-size, 2)' to respect user
theme customizations, matching the pattern used for textShadow.
@steveruizok
Copy link
Collaborator

Sorry @sahiee-dev, we're not accepting pull requests from external contributors at this time. See discussion here. If you'd like to report a bug or suggest a feature, please open an issue instead.

@mimecuvalo
Copy link
Member

i think this was actually a decent way to address the issue.

@sahiee-dev i'm reopening this - sorry we've been closing a bunch of PRs lately to reduce noise from AI-generated PRs. i'll re-examine this one more closely.

@vercel
Copy link

vercel bot commented Jan 29, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
tldraw-shader Ignored Ignored Preview Jan 29, 2026 3:41pm

Request Review

@mimecuvalo
Copy link
Member

looks like @steveruizok is redoing this over in another PR: #7796

@mimecuvalo mimecuvalo closed this Feb 2, 2026
@sahiee-dev
Copy link
Contributor Author

@mimecuvalo Thanks for revisiting this and landing a fix. Appreciate the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce tab width in rich text to 2 spaces

3 participants