Componentmedia0.39 KB gzipZero dependencies
Mention Highlight
Highlight @mentions and #hashtags inside running text.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add mention-highlightOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { MentionHighlight } from "@/components/ui/mention-highlight"; <MentionHighlight />Source code
mention-highlight.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxmention-highlight.tsx39 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface MentionHighlightProps extends React.HTMLAttributes<HTMLParagraphElement> { text: string;} /** Text highlighter for @mentions and #tags. */export function MentionHighlight({ text = "", className, ...props }: MentionHighlightProps) { const parts = React.useMemo( () => text.split(/(@[A-Za-z0-9_]+|#[A-Za-z0-9_]+)/g), [text] ); return ( <p className={cn("text-sm leading-relaxed", className)} {...props}>Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { MentionHighlight } from "@/components/ui/mention-highlight"; <MentionHighlight />| Prop | Type | Description |
|---|---|---|
| text | string | Configures text. (Default: "") |