Skip to content

Commit

Permalink
Revert "remove component docs"
Browse files Browse the repository at this point in the history
This reverts commit cb73fae.
  • Loading branch information
0xAlec committed Aug 9, 2024
1 parent f8785af commit cb60768
Showing 1 changed file with 187 additions and 0 deletions.
187 changes: 187 additions & 0 deletions site/docs/pages/wallet/wallet-dropdown-fund-link.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Wallet Components & Utilities · OnchainKit
description: Introduction to Wallet Components & Utilities
---

import {
ConnectWallet,
Wallet,
WalletDropdown,
WalletDropdownFundLink,
WalletDropdownLink,
WalletDropdownDisconnect,
} from '@coinbase/onchainkit/wallet';
import {
Address,
Avatar,
Name,
Identity,
EthBalance,
} from '@coinbase/onchainkit/identity';
import { color } from '@coinbase/onchainkit/theme';
import AppWithRK from '../../components/AppWithRK';
import WalletComponents from '../../components/WalletComponents';

# `<WalletDropdownFundLink />`

The Wallet Dropdown Fund Link provides an easy way for to access the [Funding](https://keys.coinbase.com/funding) flow for a Coinbase Smart Wallet.

## Usage

```tsx
import {
ConnectWallet,
Wallet,
WalletDropdown,
WalletDropdownLink,
WalletDropdownDisconnect,
WalletDropdownFundLink, // [!code focus]
} from '@coinbase/onchainkit/wallet'; // [!code focus]
import {
Address,
Avatar,
Name,
Identity,
EthBalance,
} from '@coinbase/onchainkit/identity';
import { color } from '@coinbase/onchainkit/theme';

export function WalletComponents() {
return (
<div className="flex justify-end">
<Wallet>
<ConnectWallet>
<Avatar className="h-6 w-6" />
<Name />
</ConnectWallet>
<WalletDropdown>
<Identity className="px-4 pt-3 pb-2" hasCopyAddressOnClick>
<Avatar />
<Name />
<Address />
<EthBalance />
</Identity>
<WalletDropdownFundLink /> // [!code focus]
<WalletDropdownLink icon="wallet" href="https://wallet.coinbase.com">
Wallet
</WalletDropdownLink>
<WalletDropdownDisconnect />
</WalletDropdown>
</Wallet>
</div>
);
}
```

<WalletComponents>
<Wallet>
<ConnectWallet>
<Avatar className="h-6 w-6" />
<Name />
</ConnectWallet>
<WalletDropdown>
<WalletDropdownFundLink />
<WalletDropdownLink icon="wallet" href="https://wallet.coinbase.com">
Wallet
</WalletDropdownLink>
<WalletDropdownDisconnect />
</WalletDropdown>
</Wallet>
</WalletComponents>

### Override text

You can override component text using the `text` prop.

```tsx
// omitted for brevity

<Wallet>
<ConnectWallet>
...
</ConnectWallet>
<WalletDropdown>
...
<WalletDropdownFundLink text="Add crypto" /> // [!code focus]
</WalletDropdown>
</Wallet>
```

<WalletComponents>
<Wallet>
<ConnectWallet>
<Avatar className="h-6 w-6" />
<Name />
</ConnectWallet>
<WalletDropdown>
<WalletDropdownFundLink text="Add crypto" />
<WalletDropdownDisconnect />
</WalletDropdown>
</Wallet>
</WalletComponents>

### Open in window

You can override default link behavior to open the funding flow in a popup window by using the `openIn` prop.

```tsx
// omitted for brevity

<Wallet>
<ConnectWallet>
...
</ConnectWallet>
<WalletDropdown>
...
<WalletDropdownFundLink openIn="window" /> // [!code focus]
</WalletDropdown>
</Wallet>
```

<WalletComponents>
<Wallet>
<ConnectWallet>
<Avatar className="h-6 w-6" />
<Name />
</ConnectWallet>
<WalletDropdown>
<WalletDropdownFundLink openIn="window" />
<WalletDropdownDisconnect />
</WalletDropdown>
</Wallet>
</WalletComponents>

### Customizing the window size

When using popup mode, you're able to customize the size of the popup window using the `windowSize` prop. Valid values are `s`, `m`, and `l`.

```tsx
// omitted for brevity

<Wallet>
<ConnectWallet>
...
</ConnectWallet>
<WalletDropdown>
...
<WalletDropdownFundLink openIn="window" windowSize="s" /> // [!code focus]
</WalletDropdown>
</Wallet>
```

<WalletComponents>
<Wallet>
<ConnectWallet>
<Avatar className="h-6 w-6" />
<Name />
</ConnectWallet>
<WalletDropdown>
<WalletDropdownFundLink openIn="window" windowSize="s" />
<WalletDropdownDisconnect />
</WalletDropdown>
</Wallet>
</WalletComponents>

## Props

- [`WalletDropdownFundLinkReact`](/wallet/types#walletdropdownfundlinkreact)

0 comments on commit cb60768

Please sign in to comment.