Aurora AI Inline Citation
aurora-dinglebear-ai/aurora-ai-inline-citationUnverifiedBlock
Aurora-native inline citation parity surface from AI Elements.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/dinglebear-ai/aurora/main/aurora-ai-inline-citation.jsonSource
1"use client"23import * as React from "react"4import { safeHttpUrl } from "@/registry/aurora/lib/safe-url"56export interface InlineCitationProps7 extends React.AnchorHTMLAttributes<HTMLAnchorElement> {8 /** 1-based citation number rendered inside the chip. */9 index: number10 /** Source title shown in the hover/focus preview popover. */11 title?: string12 /** Optional context line shown below the title. */13 description?: string14 /** Source URL shown in the hover/focus preview popover. */15 url?: string16}1718/**19 * InlineCitation — a compact rose citation chip rendered inline with body text.20 * When `title`/`url` are supplied it reveals a source preview on hover and21 * keyboard focus; otherwise it renders as a plain numbered chip.22 */23const InlineCitation = (24 { ref,25 className,26 index,27 title,28 description,29 url,30 style,31 children,32 href,33 target,34 rel,35 tabIndex,36 onMouseEnter,37 onMouseLeave,38 onFocus,39 onBlur,40 ...props41 }: InlineCitationProps & { ref?: React.Ref<HTMLAnchorElement> }42 ) => {43 const [open, setOpen] = React.useState(false)44 const resolvedHref = safeHttpUrl(href ?? url)45 const hasPreview = Boolean(title || description || url)46 const previewId = React.useId()47 const resolvedTarget = target ?? (resolvedHref ? "_blank" : undefined)48 const resolvedRel = rel ?? (resolvedHref ? "noreferrer noopener" : undefined)4950 const handleMouseEnter = React.useCallback(51 (event: React.MouseEvent<HTMLAnchorElement>) => {52 if (hasPreview) setOpen(true)53 onMouseEnter?.(event)54 },55 [hasPreview, onMouseEnter]56 )57 const handleMouseLeave = React.useCallback(58 (event: React.MouseEvent<HTMLAnchorElement>) => {59 if (hasPreview) setOpen(false)60 onMouseLeave?.(event)61 },62 [hasPreview, onMouseLeave]63 )64 const handleFocus = React.useCallback(65 (event: React.FocusEvent<HTMLAnchorElement>) => {66 if (hasPreview) setOpen(true)67 onFocus?.(event)68 },69 [hasPreview, onFocus]70 )71 const handleBlur = React.useCallback(72 (event: React.FocusEvent<HTMLAnchorElement>) => {73 if (hasPreview) setOpen(false)74 onBlur?.(event)75 },76 [hasPreview, onBlur]77 )7879 const chip = (80 <a81 ref={ref}82 className={[83 "inline-flex items-center justify-center rounded-[5px] border align-baseline no-underline",84// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aurora
All 176 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aurora AI Actionaurora-ai-action | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Actionsaurora-ai-actions | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Agentaurora-ai-agent | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Image Gridaurora-ai-ai-image-grid | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Attachmentsaurora-ai-attachments | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Audio Playeraurora-ai-audio-player | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Branchaurora-ai-branch | aurora | Blocks | Unverified | 1 dep | |
| Aurora AI Canvasaurora-ai-canvas | aurora | Blocks | Unverified | 1 dep |
