Getting started with Next.js
Generate new application
Section titled “Generate new application”If you start from scratch, you can use create-next-app to create new Next.js application:
npx create-next-app@latest --app --src-dir --typescript --tailwindpnpm dlx create-next-app@latest --app --src-dir --typescript --tailwindbunx create-next-app@latest --app --src-dir --typescript --tailwindInstall dependencies
Section titled “Install dependencies”Now that you have a Next.js app (either a new or existing one), you can install the dependencies:
npm install @wallet-ui/react @wallet-ui/corepnpm add @wallet-ui/react @wallet-ui/corebun add @wallet-ui/react @wallet-ui/coreAdd Solana Provider
Section titled “Add Solana Provider”'use client';
import { ReactNode } from 'react';import { createSolanaDevnet, createSolanaLocalnet, createWalletUiConfig, WalletUi } from '@wallet-ui/react';
const config = createWalletUiConfig({ clusters: [ // You can add mainnet when you're ready // createSolanaMainnet('https://mainnet.your-rpc.com?api-key=secret'), createSolanaDevnet(), createSolanaLocalnet(), ],});
export function SolanaProvider({ children }: { children: ReactNode }) { return <WalletUi config={config}>{children}</WalletUi>;}Add provider to your layout
Section titled “Add provider to your layout”import { SolanaProvider } from '@/components/solana-provider';
export default function RootLayout({ children }: { children: ReactNode }) { return ( <html lang="en" suppressHydrationWarning> <body> <SolanaProvider>{children}</SolanaProvider> </body> </html> );}Add styles to src/app/globals.css
Section titled “Add styles to src/app/globals.css”For more information about styling, see the Styling section.
@import 'tailwindcss';@import '@wallet-ui/tailwind/index.css';You should now be able to use the components in your app.