OpenSourceUIOpenSourceUIOpensource UI
GitHub—
  1. Home
  2. Components
  3. Loaders
  4. Apple Hello Loader
Back to LoadersComponents / Loaders

Apple Hello Loader

Free Loaders React component — AppleHelloLoader. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.

Apple-style greeting loader that cycles through hello, bonjour, hola, and more with a soft fade. Pass greetings, intervalMs, and fadeMs to tune the loop.

Preview

hello

Setup

How to use

Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/loaders/apple-hello-loader.tsx in your project.

  4. 4

    Import and render:

    Example

    import { AppleHelloLoader } from "@/components/loaders/apple-hello-loader";

    <AppleHelloLoader greetings={["hello", "hola"]} intervalMs={2600} />

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/loaders/apple-hello-loader.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"use client";
 
import { useEffect, useState } from "react";
 
import { cn } from "@/lib/cn";
 
const DEFAULT_GREETINGS = [
"hello",
"bonjour",
"hola",
"ciao",
"olá",
"namaste",
] as const;
 
export type AppleHelloLoaderProps = Readonly<{
greetings?: readonly string[];
intervalMs?: number;
fadeMs?: number;
fill?: boolean;
className?: string;
}>;
 
function usePrefersReducedMotion() {
const [reduced, setReduced] = useState(false);
 
useEffect(() => {
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
const update = () => setReduced(media.matches);
update();
media.addEventListener("change", update);
return () => media.removeEventListener("change", update);
}, []);
 
return reduced;
}
 
export function AppleHelloLoader({
greetings = DEFAULT_GREETINGS,
intervalMs = 2600,
fadeMs = 400,
fill = false,
className,
}: AppleHelloLoaderProps) {
const reducedMotion = usePrefersReducedMotion();
const [index, setIndex] = useState(0);
const [visible, setVisible] = useState(true);
const items = greetings.length > 0 ? greetings : DEFAULT_GREETINGS;
 
useEffect(() => {
if (reducedMotion || items.length <= 1) return;
 
const interval = globalThis.setInterval(() => {
setVisible(false);
globalThis.setTimeout(() => {
setIndex((current) => (current + 1) % items.length);
setVisible(true);
}, fadeMs);
}, intervalMs);
 
return () => globalThis.clearInterval(interval);
}, [fadeMs, intervalMs, items.length, reducedMotion]);
 
return (
<div
data-slot="apple-hello-loader"
className={cn(
"flex items-center justify-center bg-black",
fill ? "absolute inset-0" : "min-h-24 min-w-40 rounded-2xl px-6 py-8",
className,
)}
role="status"
aria-live="polite"
aria-label={items[index]}
>
<p
className={cn(
"px-4 text-center font-sans text-lg font-extralight tracking-tight text-white capitalize transition-all duration-500 motion-reduce:transition-none",
visible ? "translate-y-0 opacity-100" : "translate-y-1 opacity-0",
)}
>
{items[index]}
</p>
</div>
);
}
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/loaders/apple-hello-loader.tsx
Platinum slotAvailable

Feature your product here.

Sticky card next to every component — highest-intent placement.

Claim this card