Standalone

Family is the simplest way to onboard new users to your app.

1. Install the SDK

Install the family package using your preferred package manager.

Terminal
npm i family

2. Initialize the SDK

Family is initialized with a single function call. You can do this in your app's entry point (e.g., index.js or App.js).

,
src/index.jsx
import { family } from "family";
family.connect();

3. Connect to Family

,
src/index.jsx
import { FamilyAccountsSdk } from "family";
const connectWallet = () => {
FamilyAccountsSdk.session.create();
};
<button onClick={connectWallet}>Continue with Family</button>;

4. Interact with Family

Family exports an easy to use FamilyAccountsSdk object that you can use to interact with Family.

,
src/index.jsx
import { FamilyAccountsSdk } from "family";
const signMessage = (message) => {
FamilyAccountsSdk.session.signMessage(message);
};
<button onClick={signMessage}>Continue with Family</button>;

That's it—you now have a simple component that displays the connected wallet's address and allows the user to switch wallets, add chains, sign messages, and disconnect. You can use the client object to interact with Family and perform any actions you need.