Skip to content
العربية
Data display

ConnectionCard

How to reach a service: rows of host and port, user, a masked password and a command, each ready to copy. copyLabel names a row’s copy button (“Copy host”). A long value breaks onto more lines and never makes the page wider.

import { ConnectionCard, type ConnectionRow } from "@percentsa/ui";

Examples

Connect

Host and port
203.0.113.10:5432
User
app_user
Password
Hidden
Command
psql -h 203.0.113.10 -p 5432 -U app_user -d shop_example
Code
export function ConnectionCardExample() {
  const t = useT();
  return (
    <ConnectionCard
      className="w-full max-w-lg"
      title={t("Connect", "الاتصال")}
      rows={[
        { term: t("Host and port", "المضيف والمنفذ"), copy: "203.0.113.10:5432", copyLabel: t("Copy host and port", "انسخ المضيف والمنفذ") },
        { term: t("User", "المستخدم"), copy: "app_user", copyLabel: t("Copy user", "انسخ المستخدم") },
        { term: t("Password", "كلمة المرور"), masked: { label: t("Password", "كلمة المرور"), canReveal: true, onReveal: async () => "p4ss-example-only" } },
        { term: t("Command", "الأمر"), copy: "psql -h 203.0.113.10 -p 5432 -U app_user -d shop_example" },
      ]}
    />
  );
}