Installation

1. Add the package

Web (React)

npm install @dotwear/web

# Icons only
npm install @dotwear/icons

iOS (SwiftUI)

In Xcode: File › Add Package Dependencies…, enter https://github.com/dotwear-dev/dotwear-swift, and add the Dotwear library (or DotwearIcons for icons only). With Package.swift:

dependencies: [
    .package(url: "https://github.com/dotwear-dev/dotwear-swift", from: "0.1.0"),
],
targets: [
    .target(name: "MyApp", dependencies: [
        .product(name: "Dotwear", package: "dotwear-swift"),
    ]),
]

React Native

npm install @dotwear/react-native

# Icons only
npm install @dotwear/react-native-icons

Flutter

flutter pub add dotwear material_ui

# Icons only
flutter pub add dotwear_icons

Requirements: React 18 or later for the web; iOS 16 / macOS 13 or later and Swift 6 for SwiftUI; React 19 and React Native 0.78 or later for React Native; Flutter 3.47 (Dart 3.13) or later with material_ui for Flutter. The React Native packages draw with plain views, so they need no native modules.

2. Use it

Web (React)

import "@dotwear/web/tokens.css";
import "@dotwear/web/fonts.css";
import "@dotwear/web/components.css";
import "@dotwear/icons/palette.css";
import { DotwearButton, dwSave } from "@dotwear/web";

export function SaveButton() {
  return (
    <DotwearButton icon={dwSave} onClick={() => console.log("saved")}>
      Save
    </DotwearButton>
  );
}

iOS (SwiftUI)

struct ContentView: View {
    @State private var email = ""

    var body: some View {
        VStack(spacing: 16) {
            DotwearIcon(.save, scale: 2)
            TextField("Email", text: $email)
                .textFieldStyle(.dotwear)
            Button("Save") { save() }
                .buttonStyle(.dotwear)
        }
        .padding()
        .dotwearTheme()
    }

    func save() {}
}

React Native

import { useFonts } from "expo-font";
import { DotwearButton, DotwearTheme, dotwearFonts, dwSave } from "@dotwear/react-native";

export default function App() {
  // Load the bundled DotGothic16 font before showing any text
  const [fontsLoaded] = useFonts(dotwearFonts);
  if (!fontsLoaded) return null;

  return (
    <DotwearTheme>
      <DotwearButton icon={dwSave} onPress={() => console.log("saved")}>
        Save
      </DotwearButton>
    </DotwearTheme>
  );
}

Flutter

import 'package:dotwear/dotwear.dart';
import 'package:material_ui/material_ui.dart';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Colors, the bundled DotGothic16 font and icon colors
      theme: const DotwearThemeData().toThemeData(),
      home: Scaffold(
        body: Center(
          child: DotwearButton(
            icon: DotwearIcons.save,
            onPressed: () => print('saved'),
            child: const Text('Save'),
          ),
        ),
      ),
    );
  }
}
  • Web: import these once, at the root of your app: tokens.css (colors and sizes as CSS variables), fonts.css (the bundled DotGothic16 pixel font), components.css (the look of the React components) and palette.css (icon palettes). The components also work without React: put the same class names on standard elements.
  • iOS: import Dotwear also gives you the icons. .dotwearTheme() at the root is optional — without it, the default theme is used.
  • React Native: @dotwear/react-native also gives you the icons. Load the bundled DotGothic16 font once (useFonts(dotwearFonts) with Expo). With the React Native CLI, link node_modules/@dotwear/react-native/dist/generated/fonts with npx react-native-asset instead. <DotwearTheme> at the root is optional.
  • Flutter: package:dotwear/dotwear.dart also gives you the icons, and the font is bundled. DotwearThemeData().toThemeData() sets the colors, the font and the icon color; without it, components use the default theme. Dotwear is built on material_ui, the Material library for Flutter 3.47 and later.

Next