@spicenet-io/spiceflow-ui
v2.4.0
Published
Spiceflow UI SDK
Downloads
6,837
Readme
SpiceFlow UI SDK
A React component library for building DeFi swap interfaces with multi-chain support.
Installation
npm install @spicenet-io/spiceflow-uiUsage
import { SwapWidget, SpiceFlowProvider } from "@spicenet-io/spiceflow-ui";
import "@spicenet-io/spiceflow-ui/styles.css";
function App() {
return (
<SpiceFlowProvider
provider="privy"
privyAppId="your-privy-app-id"
dynamicEnvironmentId="your-env-id"
paraApiKey="your-para-api-key"
paraAppName="your-app-name"
>
<SwapWidget
swapBatches={swapBatches}
supportedChains={[1, 137, 42161]}
showSlippageSettings={true}
enableFlipSwap={true}
theme="dark"
/>
</SpiceFlowProvider>
);
}Components
- SwapWidget - Main swap interface component
- AssetSelector - Token selection component
- SpiceDeposit - Deposit modal component
- StatusDisplay - Transaction status display
- ProviderLogin - Wallet connection component
- DebugWidget - Development debugging component
- Button, Input, Modal - UI primitives
Development
Building the Library
npm run buildType Checking
npm run typecheckLinting
npm run lint
npm run lint:fixComponent Playground
This repository includes a lightweight React playground app for viewing and testing all components without the complexity of Storybook.
Running the Playground
Install dependencies (if not already done):
npm installNavigate to the playground directory:
cd playgroundInstall playground dependencies:
npm installStart the development server:
npm run devThe playground will open automatically at
http://localhost:3000
Using the Playground
- Left Sidebar: Browse available components
- Main Area: View the selected component with different example variants
- Example Tabs: Switch between different states/examples for each component
Adding a New Component Example
To add a new example variant for a component:
- Open
playground/src/ComponentRegistry.tsx - Find the component's entry in the
examplesobject - Add a new entry to the array:
{ label: 'Your Example Name', render: () => <YourComponent {...props} />, }
The playground will automatically pick up the new example and display it as a tab.
License
MIT
