Wallet UI Shadcn Registry

The Shadcn registry for Wallet UI components gets you started with Solana faster than ever!

Support for Solana Mobile comes out of the box!

Head over to tweakcn to theme your components!

Demo: select wallet and cluster to fetch your balance.

Open in

Getting started

1. Configure your shadcn config

Add the @wallet-ui registry in your shadcn config.

JSONcomponents.json
{  "$schema": "https://ui.shadcn.com/schema.json",  //... shadcn config  "registries": {    "@wallet-ui": "https://registry.wallet-ui.dev/r/{name}.json"  }}

2. Generate the components

Generate the SolanaProvider with the Solana Mobile Wallet Adapter and the useSolana hook.

pnpx shadcn@latest add @wallet-ui/solana-provider

Generate the ClusterDropdown and WalletDropdown components.

pnpx shadcn@latest add @wallet-ui/cluster-dropdown @wallet-ui/wallet-dropdown

3. Update layout

Add the SolanaProvider to the root layout of your app.

Reactapp/layout.tsx
// Other imports...import { SolanaProvider } from "@/components/solana-provider";export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) {  //...    <body >      <SolanaProvider>{children}</SolanaProvider>    </body>  //...}

4. Use the components

Add the ClusterDropdown and the WalletDropdown components to your page.

Reactapp/page.tsx
'use client'import { ClusterDropdown } from "@/components/cluster-dropdown";import { WalletDropdown } from "@/components/wallet-dropdown";import { useSolana } from "@/hooks/use-solana";export default function Home() {  const { account } = useSolana()  return (    <div className="font-sans grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20">      <main className="flex flex-col gap-[32px] row-start-2 ">        <div className='flex gap-[32px] justify-center'>          <WalletDropdown />          <ClusterDropdown />        </div>          {account ? `Connected to ${account.address}` : null}      </main>    </div>  );}

Done!

You completed the Wallet UI setup and can now use it in our apps!

Components

@wallet-ui/cluster-dropdown A cluster dropdown to select Solana clusters

Open in

@wallet-ui/wallet-disconnect A button to disconnect the connected Solana wallets

Open in

@wallet-ui/wallet-dropdown A wallet dropdown to select Solana wallets

Open in