JGuang

Terminal

Terminal · Magic UI

Preview
npx shadcn@latest add https://jiguang132.com/r/magic-ui/terminal.json

Some upstream demos use online images, videos or tweets. That content depends on network access and third-party services.

Terminal

Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/terminal.json

Use case

Sequence animated command lines and output inside a terminal frame.

Native props used by the examples

Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.

Owning component propExplanationExample source
Terminal.children (terminal)Native child content; keep the owning component's text/element constraints.examples/terminal-demo.tsx、examples/terminal-demo-2.tsx
TypingAnimation.children (terminal)Native child content; keep the owning component's text/element constraints.examples/terminal-demo.tsx、examples/terminal-demo-2.tsx
AnimatedSpan.className (terminal)Classes on this native component; initialize Tailwind and its required CSS first.examples/terminal-demo.tsx、examples/terminal-demo-2.tsx
AnimatedSpan.children (terminal)Native child content; keep the owning component's text/element constraints.examples/terminal-demo.tsx、examples/terminal-demo-2.tsx
TypingAnimation.className (terminal)Classes on this native component; initialize Tailwind and its required CSS first.examples/terminal-demo.tsx
TypingAnimation.delay (terminal)Terminal typing delay in milliseconds.examples/terminal-demo-2.tsx
AnimatedSpan.delay (terminal)Terminal line delay in milliseconds.examples/terminal-demo-2.tsx

Interaction and state checks

  • Terminal Demo — terminal-demo
  • Terminal Demo — terminal-demo-2

These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.

Business integration boundary

Terminal's TypingAnimation comes from terminal.tsx and differs from the standalone typing component. Commands are not executed and no shell is connected.

Host and motion setup

Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.

Available examples

terminal-demo, terminal-demo-2

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.

Examples

Custom Delays

Installation

<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">
npx shadcn@latest add @magicui/terminal
</TabsContent> <TabsContent value="manual"> <Steps>

<Step>Copy and paste the following code into your project.</Step>

</Steps> </TabsContent> </Tabs>

Usage

import {
  AnimatedSpan,
  Terminal,
  TypingAnimation,
} from "@/components/ui/terminal"
<Terminal>
  <TypingAnimation>pnpm dlx shadcn@latest init</TypingAnimation>
  <AnimatedSpan>✔ Preflight checks.</AnimatedSpan>
  <AnimatedSpan>✔ Validating Tailwind CSS.</AnimatedSpan>
  <TypingAnimation>Success! Project initialization completed.</TypingAnimation>
</Terminal>

The terminal sequences its children automatically. Each TypingAnimation or AnimatedSpan starts when the previous finishes. Manual delay props are optional and typically unnecessary.

Props

Terminal

PropTypeDefaultDescription
childrenReactNode-Terminal content: a list of TypingAnimation/AnimatedSpan.
classNamestring-Custom CSS class for styling.
sequencebooleantrueEnable auto sequencing so each line starts after the previous.
startOnViewbooleantrueStart sequencing when the terminal enters the viewport.

AnimatedSpan

PropTypeDefaultDescription
childrenReactNode-Content to be faded in.
classNamestring-Custom CSS class for styling.
delaynumber0Delay in ms before animation starts (used when sequence is false).
startOnViewbooleanfalseIf true, waits for viewport visibility before animating when unsequenced.

TypingAnimation

PropTypeDefaultDescription
childrenstring-Text to be typed.
classNamestring-Custom CSS class for styling.
durationnumber60Milliseconds per character.
delaynumber0Delay in ms before typing starts (used when sequence is false).
as"article" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "li" | "p" | "section" | "span""span"The component type to render.
startOnViewbooleantrueIf true, waits for viewport visibility before typing when unsequenced.

Complete example installation

The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.

Terminal Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/terminal/terminal-demo.json

Default import: @/components/magicui/examples/terminal-demo

Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0

Terminal Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/terminal/terminal-demo-2.json

Default import: @/components/magicui/examples/terminal-demo-2

Dependencies: clsx@2.1.1, motion@12.42.2, tailwind-merge@3.6.0

Minimal usage and theme

import Demo from '@/components/magicui/examples/terminal-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
  return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}

Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.

Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.

AnimatedSpan({
  children,
  delay = 0,
  className,
  startOnView = false,
  ...props
}: AnimatedSpanProps)

TypingAnimation({
  children,
  className,
  duration = 60,
  delay = 0,
  as: Component = "span",
  startOnView = true,
  ...props
}: TypingAnimationProps)

Terminal({
  children,
  className,
  sequence = true,
  startOnView = true,
}: TerminalProps)
type MotionElementType = Extract<
  keyof DOMMotionComponents,
  keyof typeof motionElements
>

interface AnimatedSpanProps extends MotionProps {
  children: React.ReactNode
  delay?: number
  className?: string
  startOnView?: boolean
}

interface TypingAnimationProps extends Omit<MotionProps, "children"> {
  children: string
  className?: string
  duration?: number
  delay?: number
  as?: MotionElementType
  startOnView?: boolean
}

interface TerminalProps {
  children: React.ReactNode
  className?: string
  sequence?: boolean
  startOnView?: boolean
}

Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.

// AnimatedSpan
delay = 0

// AnimatedSpan
startOnView = false

// TypingAnimation
duration = 60

// TypingAnimation
delay = 0

// TypingAnimation
as = "span"

// TypingAnimation
startOnView = true

// Terminal
sequence = true

// Terminal
startOnView = true

Native and external types

External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.

MotionProps
React.ReactNode
Omit<MotionProps, "children">
Extract<
  keyof DOMMotionComponents,
  keyof typeof motionElements
>
DOMMotionComponents