-
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.
- Loading branch information
Showing
3 changed files
with
204 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
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,185 @@ | ||
--- | ||
title: Wallet Components & Utilities · OnchainKit | ||
description: Introduction to Wallet Components & Utilities | ||
--- | ||
|
||
import { | ||
ConnectWallet, | ||
Wallet, | ||
WalletDropdown, | ||
WalletDropdownLink, | ||
WalletDropdownDisconnect, | ||
WalletDropdownFundLink, | ||
} from '../src/wallet'; | ||
import { Address, Avatar, Name, Identity, EthBalance } from '../src/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 { | ||
// [!code focus] | ||
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> | ||
// [!code focus] | ||
<WalletDropdown> | ||
// [!code focus] | ||
<Identity className="px-4 pt-3 pb-2" hasCopyAddressOnClick> | ||
<Avatar /> | ||
<Name /> | ||
<Address className={color.foregroundMuted} /> | ||
<EthBalance /> | ||
</Identity> | ||
<WalletDropdownFundLink /> // [!code focus] | ||
<WalletDropdownLink icon="wallet" href="https://wallet.coinbase.com"> | ||
Wallet | ||
</WalletDropdownLink> | ||
<WalletDropdownDisconnect /> | ||
</WalletDropdown> | ||
</Wallet> | ||
// [!code focus] | ||
</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 `type` prop. | ||
|
||
```tsx | ||
// omitted for brevity | ||
|
||
<Wallet> | ||
<ConnectWallet> | ||
... | ||
</ConnectWallet> | ||
<WalletDropdown> | ||
... | ||
<WalletDropdownFundLink type="window" /> // [!code focus] | ||
</WalletDropdown> | ||
</Wallet> | ||
``` | ||
|
||
<WalletComponents> | ||
<Wallet> | ||
<ConnectWallet> | ||
<Avatar className="h-6 w-6" /> | ||
<Name /> | ||
</ConnectWallet> | ||
<WalletDropdown> | ||
<WalletDropdownFundLink type="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 `size` prop. Valid values are `s`, `m`, and `l`. | ||
|
||
```tsx | ||
// omitted for brevity | ||
|
||
<Wallet> | ||
<ConnectWallet> | ||
... | ||
</ConnectWallet> | ||
<WalletDropdown> | ||
... | ||
<WalletDropdownFundLink type="window" size="s" /> // [!code focus] | ||
</WalletDropdown> | ||
</Wallet> | ||
``` | ||
|
||
<WalletComponents> | ||
<Wallet> | ||
<ConnectWallet> | ||
<Avatar className="h-6 w-6" /> | ||
<Name /> | ||
</ConnectWallet> | ||
<WalletDropdown> | ||
<WalletDropdownFundLink type="window" size="s" /> | ||
<WalletDropdownDisconnect /> | ||
</WalletDropdown> | ||
</Wallet> | ||
</WalletComponents> | ||
|
||
## Props | ||
|
||
- [`WalletDropdownFundLinkReact`](/wallet/types#walletdropdownfundlinkreact) |
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