Skip to content

Feedback ​

Alert, Progress, Spinner, và 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.

Examples ​

Một vài component tiêu biểu. Xem trang component để đủ Props / Behavior.

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 w-full 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 w-full flex-col gap-3">
        {(
          [
            ["primary", 62],
            ["success", 80],
            ["warning", 45],
            ["destructive", 25],
            ["info", 55],
          ] as const
        ).map(([color, value]) => (
          <div key={color} className="flex w-full 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>
    </>
  );
}

MINAP UI — Soft Periwinkle light, Mobile-First