feat: add Mention component - #254
Closed
brandonmcconnell wants to merge 7 commits into
Closed
Conversation
Introduces a new inline `Mention` component that renders a page or user reference as a small icon + label pill — similar to @mentions in Mintlify and Notion. - `path` prop → page mention, renders as <a> linking to the page - `user` prop → user mention, renders as <span> - `icon` accepts an FA/Lucide icon name, an image URL (rendered as circular avatar), or any React node - `color` variants: neutral, info, success, warning, feature, error - Full dark mode support via CSS custom properties - Zero runtime JS — pure Tailwind styling - Storybook stories covering all variants and inline prose usage Closes ENG-10574 Co-authored-by: Cursor <cursoragent@cursor.com>
- Add descriptions to all argTypes (children, path, user, icon, color, iconType, iconLibrary) so the autodocs table is self-documenting - Expose all iconType variants as select options - Guard against empty-string icon prop falling through to emoji branch - Add inline comment in Default story explaining path vs user and icon formats Co-authored-by: Cursor <cursoragent@cursor.com>
- py-0.5 → py-1, px-1.5 → px-2 (matches 20px Paper artboard height) - Remove whitespace-nowrap so long labels can wrap naturally - Add LongLabelWrapping story covering narrow container, forced <br />, and wrapping label inline in prose Co-authored-by: Cursor <cursoragent@cursor.com>
The previous py-0.5 looked cramped because leading-none was overriding text-xs's natural 16px line height down to 12px (font-size), producing a 16px tall pill instead of the intended 20px. Removing leading-none restores the correct 16px line height. Combined with py-0.5 (2px top + 2px bottom), the total height is exactly 20px — matching the badge artboard dimensions in the Paper design file. Horizontal padding reverted to px-1.5 (6px each side), consistent with the sm Badge variant and the artboard width calculations. Co-authored-by: Cursor <cursoragent@cursor.com>
The icon (12px) centered in the 20px pill creates a 4px gap on each
vertical side — the left padding (pl-1 = 4px) now matches that exactly,
so the icon appears equidistant from the left edge, top, and bottom,
matching the Paper design.
The right side keeps pr-2 (8px) to give the label text room to breathe.
When no icon is shown (icon={null}) both sides become px-2 — symmetric
and matching the right-side value.
Co-authored-by: Cursor <cursoragent@cursor.com>
Remove hardcoded text-xs from the component so it inherits font-size from context. Express every dimension — padding, gap, border-radius, icon size — in em so the pill scales proportionally at any font size: py = gap = pl = 1/3em → icon equidistant from left/top/bottom edges pr = 2/3em → right side has double the gap for text room rounded = 0.5em → radius scales with the pill icon = 1em → always matches the current font-size exactly leading-none anchors line-height to 1em so Tailwind's rem-based text utility line-heights don't break the proportional geometry at non-xs sizes. Add a Sizes story showing the component embedded in inline prose at five font sizes (xs → xl) to demonstrate proportional scaling. Add a text-xs meta decorator to keep all existing stories visually unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a new
Mentioncomponent to@mintlify/componentsfor rendering inline page and user references as small icon + label pillsComponent API
Single
Mentioncomponent with minimal props. Specify eitherpath(page mention) oruser(user mention):Props:
path,user,icon(FA/Lucide name, URL, or ReactNode),iconType,iconLibrary,color,classNameColor variants:
neutral(default) ·info·success·warning·feature·errorImplementation notes
--mention-bg,--mention-text)inline-flexelement designed to sit naturally inside prose contenticonprop handles FA/Lucide names, image URLs (circular avatar), and React nodesTest plan
pnpm storybookinpackages/componentsand verify all stories render correctly<a>tags, user mentions as<span>plane,bed) renders correctlyNote
Low Risk
New presentational UI in the components package with no changes to auth, data, or existing component behavior.
Overview
Adds a new
Mentioncomponent to@mintlify/componentsfor inline page and user references as icon + label pills (Paper / Notion-style @mentions).pathrenders an<a>with a default file icon;userrenders a<span>with a default person icon.iconaccepts FontAwesome/Lucide names, image URLs (circular avatars), React nodes, or can be hidden withnull. Sixcolorvariants use CSS variables with dark mode; layout usesemunits so pills scale with surrounding font size.The package barrel export and
Classes.Mentionselector are updated. Storybook stories cover colors, sizes, Lucide, avatars, prose/checklist context, and long-label wrapping.Reviewed by Cursor Bugbot for commit 965147d. Bugbot is set up for automated code reviews on this repo. Configure here.