Appearance
Feedback
Chỉ Alert, Progress, Spinner, sonner Toaster/toast.
Components
- Alert — Banner phản hồi inline. color = tông trạng thái (omit → primary).
- Progress — Thanh progress xác định.
- Toaster — Host sonner — mount một lần gần root app.
- toast — Re-export API sonner dạng imperative.
- Spinner — Chỉ báo đang tải.
Sample strip
Mỗi card chuyển Preview / Code. Full props trên trang component.
Alert
TSX
import { Alert, AlertDescription, AlertTitle } from "@minap/ui";
export function Example() {
const tones = [
["primary", "Primary (omit color ≡ this)"],
["success", "Success"],
["warning", "Warning"],
["destructive", "Destructive (danger)"],
["info", "Info"],
] as const;
return (
<>
<div className="flex flex-col gap-2">
<Alert>
<AlertTitle>Default (no color prop)</AlertTitle>
<AlertDescription>
Resolves to primary Soft Periwinkle.
</AlertDescription>
</Alert>
{tones.map(([color, title]) => (
<Alert key={color} color={color}>
<AlertTitle>{title}</AlertTitle>
<AlertDescription>status color tone.</AlertDescription>
</Alert>
))}
</div>
</>
);
}
Progress
TSX
import { Progress } from "@minap/ui";
export function Example() {
return (
<>
<div className="flex flex-col gap-3">
{(
[
["primary", 62],
["success", 80],
["warning", 45],
["destructive", 25],
["info", 55],
] as const
).map(([color, value]) => (
<div key={color} className="flex flex-col gap-1">
<Progress
value={value}
color={color}
aria-label={`${color} ${value} percent`}
/>
<p className="text-xs text-muted-foreground">
{color} — {value}%
</p>
</div>
))}
</div>
</>
);
}
Toaster
TSX
import { Button, Toaster, toast } from "@minap/ui";
export function Example() {
return (
<>
<Toaster />
<div className="flex flex-wrap gap-2">
<Button onClick={() => toast("Saved", { description: "default" })}>
Default
</Button>
<Button
variant="secondary"
onClick={() => toast.success("Done", { description: "success" })}
>
Success
</Button>
<Button
variant="secondary"
onClick={() => toast.warning("Check", { description: "warning" })}
>
Warning
</Button>
<Button
color="destructive"
onClick={() => toast.error("Failed", { description: "destructive" })}
>
Error
</Button>
<Button
variant="outline"
onClick={() => toast.info("Note", { description: "info" })}
>
Info
</Button>
</div>
</>
);
}
toast
TSX
import { Button, Toaster, toast } from "@minap/ui";
export function Example() {
return (
<>
<Toaster />
<div className="flex flex-wrap gap-2">
<Button onClick={() => toast("Saved", { description: "default" })}>
Default
</Button>
<Button
variant="secondary"
onClick={() => toast.success("Done", { description: "success" })}
>
Success
</Button>
<Button
variant="secondary"
onClick={() => toast.warning("Check", { description: "warning" })}
>
Warning
</Button>
<Button
color="destructive"
onClick={() => toast.error("Failed", { description: "destructive" })}
>
Error
</Button>
<Button
variant="outline"
onClick={() => toast.info("Note", { description: "info" })}
>
Info
</Button>
</div>
</>
);
}