npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@swapkit/ui

v0.23.0

Published

SwapKit - UI

Readme

@swapkit/ui

React components, web component assets, and Widget Studio controls for embedding the SwapKit Widget.

The SwapKit Widget gives partners a ready-made swap experience backed by SwapKit's cross-chain API and wallet integrations. Use Widget Studio to configure and copy an embed snippet, or install this package when you want to render the widget directly in a React application.

Documentation

Installation

bun add @swapkit/ui

or with npm:

npm install @swapkit/ui

Recommended integration

Most partners should configure the widget in Widget Studio and copy the generated snippet. Studio handles theme tokens, default assets, wallet and chain filters, provider credentials, and the correct CDN URL.

If you are embedding without React, use the hosted web component:

<script type="module" src="https://cdn.swapkit.dev/widget/latest/swapkit-widget.js"></script>

<swapkit-widget
  widget-id="YOUR_WIDGET_ID"
  widget-key="YOUR_WIDGET_KEY"
></swapkit-widget>

Create and manage widget keys in the SwapKit dashboard. Widget auth uses widget-id and widget-key together and is the recommended browser embed mode.

React usage

Import the stylesheet once at your app root, then render SwapKitWidget.

import { SwapKitWidget } from "@swapkit/ui/react";
import "@swapkit/ui/swapkit.css";

export function App() {
  return (
    <SwapKitWidget
      widgetId="YOUR_WIDGET_ID"
      widgetKey="YOUR_WIDGET_KEY"
    />
  );
}

Theme tokens

Use the theme prop to customize the widget. Color values are HSL channels without the hsl() wrapper.

<SwapKitWidget
  widgetId="YOUR_WIDGET_ID"
  widgetKey="YOUR_WIDGET_KEY"
  theme={{
    background: "220 18% 8%",
    surface: "220 14% 13%",
    accent: "155 86% 62%",
    primaryButton: "155 86% 62%",
    primaryButtonForeground: "220 18% 8%",
    radius: "0.5rem",
    fontFamily: 'ui-sans-serif, system-ui, sans-serif',
  }}
/>

colors is still accepted as a deprecated alias for theme to avoid breaking existing embeds.

Common props

| Prop | Type | Notes | | --- | --- | --- | | widgetId | string | Widget ID from the dashboard. Use with widgetKey. | | widgetKey | string | Widget key from the dashboard. Use with widgetId. | | apiKey | string | Alternative auth mode. Avoid exposing API keys in public browser embeds. | | apiBaseUrl | string | Override the SwapKit API URL. Usually omitted in production. | | inputAsset | string | Initial pay asset, for example BTC.BTC. | | outputAsset | string | Initial receive asset, for example ETH.USDT-0x.... | | wallets | WalletConfig | Restrict wallet options with an explicit list, all, none, include, or exclude. | | chains | ChainConfig | Restrict supported chains with an explicit list, all, include, or exclude. | | theme | SwapKitThemeTokens | Theme tokens for colors, radius, and font family. | | config | object | SDK wallet/provider credentials such as WalletConnect, Xaman, Radix, Trezor, Coinbase, and Passkeys. | | developMode | boolean | Enables development behavior. Omit in production. | | devApiUrl | string | API URL used with developMode. | | disableTelemetry | boolean | Disables widget telemetry in React embeds. | | syncUrl | boolean | Sync selected assets and amount to URL query params. |

Web component attributes

The web component accepts kebab-case equivalents for browser embeds:

<swapkit-widget
  widget-id="YOUR_WIDGET_ID"
  widget-key="YOUR_WIDGET_KEY"
  input-asset="BTC.BTC"
  output-asset="ETH.USDT-0xdAC17F958D2EE523A2206206994597C13D831EC7"
  wallets="METAMASK,WALLETCONNECT"
  chains="BTC,ETH,ARB,BASE"
  color-primary="220 18% 8%"
  color-secondary="220 14% 13%"
  color-accent="155 86% 62%"
  border-radius="0.5rem"
  font-family="ui-sans-serif, system-ui, sans-serif"
></swapkit-widget>

Theme and config attributes are observed, so updating attributes at runtime re-renders the widget.

Wallet provider configuration

Some wallets require provider credentials before they can connect. Prefer configuring these in Widget Studio so the generated snippet includes the correct config payload.

Example web component config:

<swapkit-widget
  widget-id="YOUR_WIDGET_ID"
  widget-key="YOUR_WIDGET_KEY"
  config='{"apiKeys":{"walletConnectProjectId":"...","xaman":"..."}}'
></swapkit-widget>

Example React config:

<SwapKitWidget
  widgetId="YOUR_WIDGET_ID"
  widgetKey="YOUR_WIDGET_KEY"
  config={{
    apiKeys: {
      walletConnectProjectId: "...",
      xaman: "...",
    },
  }}
/>

Widget Studio controls

This package also exports the Studio controls used by the playground and hosted Studio.

import { SwapKitWidgetControls, useSwapKitWidgetControlsForm } from "@swapkit/ui/react/controls";

Use these only when building or extending Studio-like tooling. Normal partner embeds should use the generated snippet or SwapKitWidget.

Local development

From the repository root:

bun install
bun run playground:vite-lite dev

Package commands:

bun --cwd packages/ui run type-check
bun --cwd packages/ui run build

The Vite playground aliases React source for hot reload, but serves the package stylesheet and standalone widget assets from packages/ui/dist. Rebuild packages/ui after changes that affect generated CSS or the standalone web component.

Exports

  • @swapkit/ui/react - React widget, composable components, hooks, and types.
  • @swapkit/ui/react/controls - Widget Studio controls.
  • @swapkit/ui/swapkit.css - Widget stylesheet for React consumers.
  • CDN web component - https://cdn.swapkit.dev/widget/latest/swapkit-widget.js.