Aurora AI Context
aurora-dinglebear-ai/aurora-ai-contextUnverifiedBlock
Aurora-native context parity surface from AI Elements.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/dinglebear-ai/aurora/main/aurora-ai-context.jsonSource
1"use client"23import * as React from "react"4import { Layers2, X, CircleAlert } from "lucide-react"5import { Button } from "@/registry/aurora/ui/button"67export interface ContextSegment {8 /** Display label, e.g. "System" */9 label: string10 /** Token count for this segment */11 value: number12 /** Optional explicit swatch color (defaults to the Aurora segment palette by index) */13 color?: string14}1516export interface ContextPanelProps extends React.HTMLAttributes<HTMLDivElement> {17 /** Heading label (default "Context") */18 label?: string19 /** Total context window size in tokens */20 limit?: number21 /** Pre-summed used tokens. Ignored when `segments` is provided (sum is used instead). */22 used?: number23 /** Per-bucket breakdown that drives the segmented bar + legend */24 segments?: ContextSegment[]25 /** Tokens reserved for output — drawn as a hatched slice and surfaced in the legend/warning */26 reserved?: number27 /** Render the streaming shimmer on the leading segment */28 streaming?: boolean29 /** When provided, shows the "Compact" affordance in the header */30 onCompact?: () => void31 /** "default" (full panel) or "compact" (single inline row) */32 variant?: "default" | "compact"33 /** Token usage ratio (0–1) that flips the panel into its near-limit warning state. Default 0.9 */34 warnThreshold?: number35}3637function panelStyle(style?: React.CSSProperties): React.CSSProperties {38 return {39 background: "var(--aurora-surface-raised)",40 border: "1px solid var(--aurora-border-strong)",41 borderRadius: "var(--aurora-radius-1)",42 boxShadow: "var(--aurora-shadow-medium), var(--aurora-highlight-medium)",43 ...style,44 }45}4647function formatTokenCount(value: number) {48 if (value >= 1000) return `${(value / 1000).toFixed(value >= 10000 ? 0 : 1)}k`49 return `${value}`50}5152/** Aurora segment palette: cyan → teal → sand(axon-orange) → neutral, cycling. Violet dropped. */53const SEGMENT_COLORS = [54 "var(--aurora-accent-primary)",55 "var(--aurora-success)",56 "var(--axon-orange)",57 "var(--aurora-neutral)",58]5960const HATCH_FILL =61 "repeating-linear-gradient(45deg, color-mix(in srgb, var(--aurora-text-muted) 22%, transparent) 0 4px, transparent 4px 8px)"6263const ContextPanel = (64 { ref,65 label = "Context",66 limit = 128000,67 used,68 segments,69 reserved = 0,70 streaming = false,71 onCompact,72 variant = "default",73 warnThreshold = 0.9,74 className,75 style,76 ...props77// … 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 |
