-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit cb73fae.
- Loading branch information
Showing
1 changed file
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |