Skip to content

feat(mosaic): add MiddleTruncate - #11020

Draft
alexcarpenter wants to merge 3 commits into
mainfrom
carp/use-middle-truncation
Draft

alexcarpenter wants to merge 3 commits into
mainfrom
carp/use-middle-truncation

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description

Adds MiddleTruncate, for emails, names and IDs that need their end visible: <MiddleTruncate tail={6}>{userId}</MiddleTruncate>. It keeps the last tail characters, truncates the middle, and shows the full value in a tooltip only while the text overflows. It is not exported from a public subpath yet; the Swingset page is at /components/middle-truncate.

  • The truncation is CSS only, with no JS measuring, so the first paint should need no correction after hydration (not yet verified with server rendering). A hidden break-all copy wraps when the text doesn't fit, and a container query (height > 1lh) shows the … and the fade.
  • The … sits flush against the cut letter, with a 0.6em mask-image fade instead of text-overflow (which leaves a gap of up to one letter). The mask means no background color has to match the surface. Approach adapted from @pierre/truncate.
  • Splitting counts graphemes (Intl.Segmenter), so emoji and flags aren't cut apart.
  • JS only drives the tooltip and the tab stop: the text is focusable only while it overflows, and never inside a control.
  • Only checked in Chrome so far. Safari and Firefox are unverified.
After (220px wide)
MiddleTruncate examples at 220px

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@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
clerk-js-sandbox Ready Ready Preview Nov 26, 2026 12:35am UTC
mosaic-docs Ready Ready Preview Nov 26, 2026 12:35am UTC
swingset Ready Ready Preview Nov 26, 2026 12:35am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca62e97

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@alexcarpenter alexcarpenter changed the title feat(mosaic): add MiddleTruncate prototype feat(mosaic): add MiddleTruncate Nov 26, 2026
@vercel
vercel Bot temporarily deployed to Preview – clerk-js-sandbox November 26, 2026 00:30 Inactive
@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@11020

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@11020

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@11020

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@11020

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@11020

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@11020

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@11020

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@11020

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@11020

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@11020

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@11020

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@11020

@clerk/express

npm i https://pkg.pr.new/@clerk/express@11020

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@11020

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@11020

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@11020

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@11020

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@11020

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@11020

@clerk/react

npm i https://pkg.pr.new/@clerk/react@11020

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@11020

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@11020

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@11020

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@11020

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@11020

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@11020

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@11020

commit: ca62e97

This branch was successfully deployed

2 active deployments
Preview – swingset — ca62e97e Deployed Nov 26, 2026 by vercel[bot]
Preview – clerk-js-sandbox — ca62e97e 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant