JGuang

Safari

Safari · Magic UI

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

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

Safari

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

Use case

Present images or videos inside a browser-window mockup.

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
Safari.url (safari)Displayed Safari mockup address label.examples/safari-demo.tsx、examples/safari-demo-2.tsx、examples/safari-demo-3.tsx、examples/safari-demo-4.tsx
Safari.imageSrc (safari)Image source shown inside the Safari mockup.examples/safari-demo-2.tsx
Safari.videoSrc (safari)Video source; network, format and autoplay restrictions still apply.examples/safari-demo-3.tsx
Safari.mode (safari)The owning component's native mode; consult its own union, not another library's mode.examples/safari-demo-4.tsx

Interaction and state checks

  • Safari Demo — safari-demo
  • Safari Demo 2 — safari-demo-2
  • Safari Demo 3 — safari-demo-3
  • Safari Demo 4 — safari-demo-4

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

url is a displayed label, not a browsing engine. mode chooses the visual frame; media still needs valid sources.

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

safari-demo, safari-demo-2, safari-demo-3, safari-demo-4

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

Installation

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

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

<Step>Update the import paths to match your project setup.</Step>

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

Examples

With Image

With Video

Simple Mode

Usage

import { Safari } from "@/components/ui/safari"
<Safari url="https://magicui.design" />

Props

PropTypeDefaultDescription
urlstring-The URL to display in the Safari address bar
imageSrcstring-The source URL of the image to display in the Safari window
videoSrcstring-The source URL of the video to display in the Safari window
modeSafariMode"default"The display mode of the Safari window.
classNamestring-Additional classes applied to the wrapper <div>
styleReact.CSSProperties-Inline styles applied to the wrapper <div>

Notes

  • Sizing: width and height props have been removed. The size is controlled by the wrapper <div>. The component enforces the aspect ratio 1203/753.
  • Masking: The screen area is only masked when media (src or videoSrc) is provided. Without media, only the frame is rendered.
  • HTML Attributes: The Safari component accepts all standard HTMLDivElement props.
  • iOS Compatibility: Video is rendered as a DOM overlay instead of foreignObject to avoid Safari/iOS masking issues.

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.

Safari Demo

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

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

Dependencies: clsx@2.1.1, tailwind-merge@3.6.0

Safari Demo 2

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

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

Dependencies: clsx@2.1.1, tailwind-merge@3.6.0

Safari Demo 3

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

Default import: @/components/magicui/examples/safari-demo-3

Dependencies: clsx@2.1.1, tailwind-merge@3.6.0

Safari Demo 4

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

Default import: @/components/magicui/examples/safari-demo-4

Dependencies: clsx@2.1.1, tailwind-merge@3.6.0

Minimal usage and theme

import Demo from '@/components/magicui/examples/safari-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.

Safari({
  imageSrc,
  videoSrc,
  url,
  mode = "default",
  className,
  style,
  ...props
}: SafariProps)
type SafariMode = "default" | "simple"

export interface SafariProps extends HTMLAttributes<HTMLDivElement> {
  url?: string
  imageSrc?: string
  videoSrc?: string
  mode?: SafariMode
}

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.

// Safari
mode = "default"

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.

HTMLAttributes<HTMLDivElement>
HTMLDivElement