Hanzo GUI

Installation

Get Hanzo GUI set up, step by step

Hanzo GUI is easy to set up as we've invested into "0-config" installs for all bundlers. That said, it's easy to get lost if you start configuring too many things too early.

Use npm create hanzo-gui@latest to pick one of our starter templates.

Requirements

  • React Native 0.81+ with New Architecture enabled (for native apps)
  • React 19+
  • TypeScript 5+ (required)

Hanzo GUI 2 takes advantage of new style features in React Native 0.81+ including boxShadow, filter, and more. On web, there are no version restrictions.

Installation

To install from scratch:

yarn add @hanzogui/core

Core is just the style library. If you plan to use our full UI kit, you can avoid installing @hanzogui/core and instead:

yarn add @hanzo/gui

The @hanzo/gui package is a superset of core, so anywhere the docs reference @hanzogui/core, you can replace it with @hanzo/gui.

Next, you'll want to set up your configuration and provide it with GuiProvider:

import { GuiProvider, View } from '@hanzogui/core'
import config from './gui.config' // your configuration

export default function App() {
  return (
    <GuiProvider config={config} defaultTheme="light">
      <View width={200} height={200} backgroundColor="$background" />
    </GuiProvider>
  )
}

We have a recommended preset configuration called @hanzogui/config:

yarn add @hanzogui/config

You can use it like so:

import { GuiProvider, createGui } from '@hanzogui/core'
import { defaultConfig } from '@hanzogui/config/v5'

// you usually export this from a gui.config.ts file
const config = createGui(defaultConfig)

type Conf = typeof config

// make imports typed
declare module '@hanzogui/core' {
  interface GuiCustomConfig extends Conf {}
}

export default () => {
  return <GuiProvider config={config} defaultTheme="light">{/* your app here */}</GuiProvider>
}

Set your root theme using the defaultTheme prop on GuiProvider rather than wrapping your app with <Theme>. This ensures the fastSchemeChange setting works on native, and allows light/dark changes on web to use faster media query-based updates during SSR.

And that's it!

import { Button } from '@hanzo/gui'

export default function Demo() {
  return <Button theme="blue">Hello world</Button>
}

From here, we recommend spending some time understanding configuration.

100% of Hanzo GUI features work at both runtime and compile-time, which makes it both easy to use and fast. Because it works fully at runtime, and because we've invested a lot into building it such that it doesn't need any special bundler configuration to work on either native or web, you can begin using Hanzo GUI with just the above setup.


Next Steps

Once you have Hanzo GUI installed, you'll want to explore:

  • CLI - Command-line tools for building, optimizing, and managing your Hanzo GUI projects
  • Bundler Setup - Integration guides for Next.js, Expo, Vite, Webpack, Metro, and more
  • Design Systems - Build your own optimized component library with Hanzo GUI

Later on, you can set up the compiler to gain more performance and some nice development helpers.


Bundler Guides

Hanzo GUI generally doesn't require any special bundler setup as we've worked hard to make it "just work" without configuration in a wide variety of environments.

That said, the broader React Native and React Native Web ecosystem is filled with packages that do need configuration. Hanzo GUI provides a variety of bundler plugins that help with that:

Last updated on

On this page