Skip to content

feat: add Mention component - #254

Closed
brandonmcconnell wants to merge 7 commits into
mainfrom
feat/mention-component
Closed

feat: add Mention component#254
brandonmcconnell wants to merge 7 commits into
mainfrom
feat/mention-component

Conversation

@brandonmcconnell

@brandonmcconnell brandonmcconnell commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduces a new Mention component to @mintlify/components for rendering inline page and user references as small icon + label pills

    Google Chrome 2026-08-13 22 20 21
    CleanShot 2026-08-13 at 22 19 41@2x
    Google Chrome 2026-08-13 22 19 39

Component API

Single Mention component with minimal props. Specify either path (page mention) or user (user mention):

{/* Page mention — renders as a link */}
<Mention path="/travel" icon="plane" color="info">Travel</Mention>
<Mention path="/accommodation" icon="bed" color="info">Accommodation & Meals</Mention>

{/* User mention */}
<Mention user="james-baduor" color="info">James Baduor</Mention>

{/* User mention with avatar URL */}
<Mention user="james-baduor" icon="https://example.com/avatar.jpg">James Baduor</Mention>

Props: path, user, icon (FA/Lucide name, URL, or ReactNode), iconType, iconLibrary, color, className

Color variants: neutral (default) · info · success · warning · feature · error

Implementation notes

  • Zero runtime JS — pure CSS/Tailwind, no client-side logic
  • Full dark mode support via CSS custom properties (--mention-bg, --mention-text)
  • Inline inline-flex element designed to sit naturally inside prose content
  • icon prop handles FA/Lucide names, image URLs (circular avatar), and React nodes
  • Storybook stories cover all color variants, page/user types, inline prose context, and the design reference layout

Test plan

  • Run pnpm storybook in packages/components and verify all stories render correctly
  • Confirm page mentions render as <a> tags, user mentions as <span>
  • Test icon URL renders as circular avatar image
  • Test custom icon name (e.g. plane, bed) renders correctly
  • Verify dark mode colors look correct
  • Check inline prose story matches the Paper design reference

Note

Low Risk
New presentational UI in the components package with no changes to auth, data, or existing component behavior.

Overview
Adds a new Mention component to @mintlify/components for inline page and user references as icon + label pills (Paper / Notion-style @mentions).

path renders an <a> with a default file icon; user renders a <span> with a default person icon. icon accepts FontAwesome/Lucide names, image URLs (circular avatars), React nodes, or can be hidden with null. Six color variants use CSS variables with dark mode; layout uses em units so pills scale with surrounding font size.

The package barrel export and Classes.Mention selector 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.

brandonmcconnell and others added 7 commits August 13, 2026 19:50
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>
@brandonmcconnell
brandonmcconnell marked this pull request as ready for review August 14, 2026 05:13
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.

1 participant