nano-ux
GitHub
Theme: Dark

Documentation

Setup

Install

npm install nano-ux

Configure the theme

index.css
@import "nano-ux/tailwind.css";
@source "./index.html";
@source "./src";

:root {
  --color-brand: var(--theme-lime);
  --font-family: Georgia, serif;
  --tracking: 0em;
  --spacing: 0.25rem;
  --radius-control: 0.375rem;
  --radius-card: 0.625rem;
}
--color-brand
Choose any theme color for primary buttons and controls. It adapts automatically to light and dark modes.
--font-family
Sets the main typeface. List fallback fonts in order of preference.
--tracking
Adjusts the space between letters in body text, labels, and headings.
--spacing
Sets the base unit for padding, margins, and gaps.
--radius-control
Sets the corner radius of buttons and form fields.
--radius-card
Sets the corner radius of cards and panels.

Extend the theme

index.css
@import "nano-ux/tailwind.css";
@source "./index.html";
@source "./src";

:root {
  --theme-coral: light-dark(#b23a32, #ff9e92);
  --color-brand: var(--theme-coral);
}

@theme inline {
  --color-coral: var(--theme-coral);
}

In light-dark(), the first value sets the light mode color and the second sets the dark mode color. Assign it to --color-brand to use it for controls. The @theme inline rule adds Tailwind utilities such as bg-coral and text-coral.

CSS classes

CSS .card, .card-shell, .card-outline, .card-ghost, .card-tint, .card-elevated

  • .card

    Filled surface with padding.

  • .card-shell

    Filled frame without padding.

  • .card-outline

    Transparent surface with a border.

  • .card-ghost

    Transparent surface and border.

  • .card-tint

    Tinted card using the theme accent by default.

  • .card-elevated

    Add an inner highlight and a soft lift.


CSS .tint, .tint-cocoa, .tint-lime, .tint-fern, .tint-mint, .tint-seafoam, .tint-glacier, .tint-cyan, .tint-ocean, .tint-klein, .tint-violet, .tint-berry, .tint-pitaya, .tint-morello

Use .tint to tint the background and border with the theme accent. If no accent is set, it uses the standard surface and border colors. Add a color class such as .tint-ocean to set the tint. Use a hex color in brackets with nano-ux/tailwind.css.

  • .tint
  • .tint-cocoa
  • .tint-lime
  • .tint-fern
  • .tint-mint
  • .tint-seafoam
  • .tint-glacier
  • .tint-cyan
  • .tint-ocean
  • .tint-klein
  • .tint-violet
  • .tint-berry
  • .tint-pitaya
  • .tint-morello
  • .tint-[#0ff]

CSS .glow, .glow-cocoa, .glow-lime, .glow-fern, .glow-mint, .glow-seafoam, .glow-glacier, .glow-cyan, .glow-ocean, .glow-klein, .glow-violet, .glow-berry, .glow-pitaya, .glow-morello

Use .glow or .glow-* to add a glow with the theme accent or a theme color. Use a hex color in brackets with nano-ux/tailwind.css.

The glow follows the rendered shape, so it applies to cards, SVG icons, and masked elements.

  • .glow
  • .glow-cocoa
  • .glow-lime
  • .glow-fern
  • .glow-mint
  • .glow-seafoam
  • .glow-glacier
  • .glow-cyan
  • .glow-ocean
  • .glow-klein
  • .glow-violet
  • .glow-berry
  • .glow-pitaya
  • .glow-morello
  • .glow-[#0ff]
  • .glow
  • .glow-cocoa
  • .glow-lime
  • .glow-fern
  • .glow-mint
  • .glow-seafoam
  • .glow-glacier
  • .glow-cyan
  • .glow-ocean
  • .glow-klein
  • .glow-violet
  • .glow-berry
  • .glow-pitaya
  • .glow-morello

CSS .text-glow, .text-glow-brand, .text-glow-cocoa, .text-glow-lime, .text-glow-fern, .text-glow-mint, .text-glow-seafoam, .text-glow-glacier, .text-glow-cyan, .text-glow-ocean, .text-glow-klein, .text-glow-violet, .text-glow-berry, .text-glow-pitaya, .text-glow-morello, .text-glow-[#0ff]

Use .text-glow for the primary color or .text-glow-brand for the brand color. Both fall back to the text color. Named palette glows use their own colors.

nano-ux/theme.css includes the named palette glows. With nano-ux/tailwind.css, use .text-glow-* for additional theme colors or custom colors.

  • .text-glow
  • .text-glow-brand
  • .text-glow-cocoa
  • .text-glow-lime
  • .text-glow-fern
  • .text-glow-mint
  • .text-glow-seafoam
  • .text-glow-glacier
  • .text-glow-cyan
  • .text-glow-ocean
  • .text-glow-klein
  • .text-glow-violet
  • .text-glow-berry
  • .text-glow-pitaya
  • .text-glow-morello
  • .text-glow-[#0ff]

CSS .anchor

Use .anchor to underline a link, as in Typography.


CSS .typo-lg, .prose, .heading-hero, .text-box-trim, .trim-ex

.typo-lg
Use the larger type scale.
.prose
Limit text width to 60ch.
.heading-hero
Use the responsive hero size on an h1.
.text-box-trim
Trim space to the capital letter height and baseline.
.trim-ex
Trim space to the lowercase x-height and baseline.

CSS .light, .dark, .invert

.light
Set the light color scheme.
.dark
Set the dark color scheme.
.invert
Swap the theme foreground and background colors.

CSS .bg-surface, .text-fg-muted, .border-border, .rounded-card

.bg-surface
Use the theme surface color as a background.
.text-fg-muted
Use the muted text color.
.border-border
Use the theme border color.
.rounded-card
Use the theme card radius.

Components

Component ThemeSelector

The selector cycles through System, Light, and Dark. It restores the saved preference and uses defaultTheme when no preference is available.

import cx from "clsx-tw";
import { ThemeSelector } from "nano-ux";

type HeaderProps = { className?: string };

export const Header = ({ className }: HeaderProps) => (
	<header className={cx("flex items-center gap-3", className)}>
		<ThemeSelector
			className="static shrink-0"
			defaultTheme="system"
			tooltipPlacement="bottom"
		/>
		<p className="m-0 text-sm text-fg-muted">
			Press <kbd>Shift + T</kbd> while focused to toggle the theme.
		</p>
	</header>
);

Component Dialog

Set open to control visibility. Escape requests close. Enable closeOnBackdrop to close on outside clicks. Set busy during confirmation to prevent dismissal and repeat submission.

import { Button, Dialog } from "nano-ux";
import React from "react";

type ArchivePromptProps = { className?: string };

export const ArchivePrompt = ({ className }: ArchivePromptProps) => {
	const [open, setOpen] = React.useState(false);
	const [busy, setBusy] = React.useState(false);
	const [archived, setArchived] = React.useState(false);

	const confirm = async () => {
		setBusy(true);

		const { promise, resolve } = Promise.withResolvers<void>();

		window.setTimeout(resolve, 300);
		await promise;
		setArchived(true);
		setOpen(false);
		setBusy(false);
	};

	return (
		<div className={className}>
			<Button type="button" disabled={archived} onClick={() => setOpen(true)}>
				{archived ? "Archived" : "Archive"}
			</Button>
			<Dialog
				open={open}
				title="Archive profile?"
				confirmLabel="Archive"
				closeOnBackdrop
				busy={busy}
				onConfirm={confirm}
				onClose={() => setOpen(false)}
			>
				The profile will move to the archive.
			</Dialog>
		</div>
	);
};

Archive profile?

The profile will move to the archive.

Component Toast

Set the duration in milliseconds and use the close reason to restore focus after manual dismissal.

import { Button, Toast } from "nano-ux";
import { useState } from "react";

export const Notice = () => {
  const [trigger, setTrigger] = useState<HTMLButtonElement>();

  return <>
    <Button as="button" type="button" onClick={e => setTrigger(e.currentTarget)}>
      Show toast
    </Button>
    {trigger && <Toast message="Saved" duration={5000}
      onClose={reason => {
        if (reason === "dismiss") trigger.focus();
        setTrigger(undefined);
      }} />}
  </>;
};

Component Mockup

Terminal inherits the current theme. Set appearance to light or dark to override it. Browser is the default variant and accepts an optional address.

import { Mockup } from "nano-ux";

export const Previews = () => (
  <>
    <Mockup variant="terminal">
      {"$ pnpm build\nBuild complete."}
    </Mockup>
    <Mockup address="https://example.com">
      <p>Project overview</p>
    </Mockup>
    <Mockup variant="smartphone">
      <p>Mobile inbox</p>
    </Mockup>
  </>
);
terminal
$ pnpm build Build complete.
browser
https://example.com

Project overview

smartphone

Mobile inbox


Component Code

Pass source text and its language for syntax highlighting. The copy button appears by default. Set copyable to false to hide it.

import { Code } from "nano-ux";

export const Source = () => (
  <Code language="typescript" text={"const count: number = 12;"} />
);
const count: number = 12;

Component Form

Pass the result of useForm to Form. Use field rules for validation and isSubmitting to show feedback while the save runs.

import cx from "clsx-tw";
import { Button, Form, Input } from "nano-ux";
import React from "react";
import { useForm } from "react-hook-form";

type ProfileFormProps = { className?: string };

export const ProfileForm = ({ className }: ProfileFormProps) => {
	const form = useForm({ defaultValues: { name: "" } });
	const [savedName, setSavedName] = React.useState("");

	return (
		<Form
			className={cx("grid gap-3", className)}
			form={form}
			onSubmit={async ({ name }) => {
				const { promise, resolve } = Promise.withResolvers<void>();

				window.setTimeout(resolve, 300);
				await promise;
				setSavedName(name);
			}}
		>
			<Input name="name" label="Name" rules={{ required: "Enter a name." }} />
			<Button
				className="justify-self-start"
				type="submit"
				loading={form.formState.isSubmitting}
			>
				Save
			</Button>
			{!!savedName && <p role="status">Saved {savedName}</p>}
		</Form>
	);
};

Component SelectMulti

Mode "one" submits a string. Mode "many" submits an array. Set searchable to false to hide search. The async fetcher loads local sample data.

import { Button, Form, SelectMulti } from "nano-ux";
import { useState } from "react";
import { useForm } from "react-hook-form";

type ColorFormValues = {
  color: string;
  colors: string[];
  colorsWithoutSearch: string[];
  asyncColors: string[];
};

export const ColorForm = () => {
  const form = useForm<ColorFormValues>({
    defaultValues: { color: "", colors: [], colorsWithoutSearch: [], asyncColors: [] },
  });
  const [fetcher, setFetcher] = useState(() => loadColors);
  const [savedColors, setSavedColors] = useState<ColorFormValues>();
  const reloadOptions = () => setFetcher(() => () => loadColors());

  return (
    <Form className="grid gap-3" form={form} onSubmit={setSavedColors}>
      <SelectMulti name="color" label="Single selection"
        mode="one" options={options} searchable={false} />
      <SelectMulti name="colors" label="Multiple selection"
        mode="many" options={options} />
      <SelectMulti name="colorsWithoutSearch" label="Multiple selection without search"
        mode="many" options={options} searchable={false} />
      <div className="relative">
        <SelectMulti name="asyncColors" label="Async options"
          mode="many" fetcher={fetcher} />
        <button className="anchor absolute end-0 top-0 text-sm" type="button"
          onClick={reloadOptions}>
          Reload options
        </button>
      </div>
      <Button className="justify-self-end" type="submit">Save</Button>
      {!!savedColors && (
        <output className="font-mono text-sm whitespace-pre-wrap">
          {JSON.stringify(savedColors, null, 2)}
        </output>
      )}
    </Form>
  );
};

const loadColors = async () => {
  const { promise, resolve } = Promise.withResolvers<void>();

  window.setTimeout(resolve, 2000);
  await promise;
  return options;
};

const options = ["Black", "Blue", "Brown", "Gray", "Green", "Orange", "Pink", "Purple", "Red", "Teal", "White", "Yellow"].map((label) => ({ label, value: label.toLowerCase() }));

No options found


Component Spinner

Render Spinner while content loads. By default, it centers the medium arc spinner in the visible part of its parent. Use centered={false} for an inline indicator, as shown here.

import { Spinner } from "nano-ux";

export const LoadingProfiles = () => (
  <span role="status" className="inline-flex items-center gap-2">
    <Spinner centered={false} size="sm" label="Loading profiles" />
    Loading profiles…
  </span>
);
Loading profiles…

Component SpinnerProvider

Set defaultVariant="orbit" to use the built-in orbit spinner for every Spinner inside the provider that omits variant. Register a custom renderer in variants and select it with variant="pulse" on an individual spinner.

import cx from "clsx-tw";
import { Spinner, SpinnerProvider, type SpinnerRendererProps } from "nano-ux";
import React from "react";

const Pulse = ({ className }: SpinnerRendererProps) => (
	<span
		className={cx(
			className,
			"rounded-full bg-current motion-safe:animate-pulse",
		)}
		aria-hidden="true"
	/>
);

type PulseSpinnerProps = { className?: string };

export const PulseSpinner = ({ className }: PulseSpinnerProps) => (
	<SpinnerProvider variants={{ pulse: Pulse }} defaultVariant="orbit">
		<div className={cx("flex items-center gap-3", className)}>
			<Spinner centered={false} label="Loading profiles" />
			<Spinner centered={false} variant="pulse" label="Loading activity" />
		</div>
	</SpinnerProvider>
);

Component Button

Choose solid, outline, or ghost with variant. Pass a product color such as seafoam or ocean in the color prop. Set loading during an async action to show a spinner and prevent repeat clicks.

import { Button } from "nano-ux";
import React from "react";

type SaveButtonProps = { className?: string };

export const SaveButton = ({ className }: SaveButtonProps) => {
	const [loading, setLoading] = React.useState(false);
	const [saved, setSaved] = React.useState(false);

	const save = async () => {
		setLoading(true);

		const { promise, resolve } = Promise.withResolvers<void>();

		window.setTimeout(resolve, 500);
		await promise;
		setSaved(true);
		setLoading(false);
	};

	return (
		<Button
			className={className}
			type="button"
			variant="outline"
			loading={loading}
			disabled={saved}
			onClick={save}
		>
			{saved ? "Saved" : "Save"}
		</Button>
	);
};

Component Accordion

Use title for the trigger and summary for text visible when collapsed. Set defaultExpanded to open the panel on first render.

import { Accordion } from "nano-ux";

type BillingDetailsProps = { className?: string };

export const BillingDetails = ({ className }: BillingDetailsProps) => (
	<Accordion
		className={className}
		title="Billing details"
		summary="Monthly plan"
	>
		<p>Invoices are sent to your billing email address.</p>
	</Accordion>
);

Invoices are sent to your billing email address.


Component Tooltip

Wrap one trigger with Tooltip. Hover or focus it with the keyboard to show content. Set placement to top or bottom.

import { Button, Tooltip } from "nano-ux";

type AccordionLinkProps = { className?: string };

export const AccordionLink = ({ className }: AccordionLinkProps) => (
	<Tooltip content="Jump to the Accordion example" placement="bottom">
		<Button
			className={className}
			as="a"
			href="#reference-accordion"
			variant="outline"
		>
			Billing details
		</Button>
	</Tooltip>
);
Billing detailsJump to the Accordion example

Component ChartLine

Use ISO timestamps and list values in series order. Set interval to match the data and use valueFormatter to format values.

import { ChartLine } from "nano-ux/charts/line";

type DailySignupsProps = { className?: string };

export const DailySignups = ({ className }: DailySignupsProps) => (
	<ChartLine
		className={className}
		label="Daily signups"
		interval="day"
		series={[{ name: "Signups" }]}
		data={[
			{ timestamp: "2025-09-21T00:00:00Z", values: [12] },
			{ timestamp: "2025-09-22T00:00:00Z", values: [18] },
			{ timestamp: "2025-09-23T00:00:00Z", values: [15] },
			{ timestamp: "2025-09-24T00:00:00Z", values: [23] },
			{ timestamp: "2025-09-25T00:00:00Z", values: [20] },
			{ timestamp: "2025-09-26T00:00:00Z", values: [25] },
			{ timestamp: "2025-09-27T00:00:00Z", values: [19] },
			{ timestamp: "2025-09-28T00:00:00Z", values: [17] },
			{ timestamp: "2025-09-29T00:00:00Z", values: [27] },
			{ timestamp: "2025-09-30T00:00:00Z", values: [30] },
		]}
		valueFormatter={String}
	/>
);

Component ChartBar

Provide one value per series in series order. Use Compare paid signups to add a second bar per category. Set stacked to false to keep both bars side by side.

import cx from "clsx-tw";
import { Button } from "nano-ux";
import { ChartBar } from "nano-ux/charts/bar";
import React from "react";

type SignupsBySourceProps = { className?: string };

const sources = [
	{ label: "Search", free: 24, paid: 9 },
	{ label: "Referral", free: 18, paid: 12 },
	{ label: "Social", free: 21, paid: 7 },
	{ label: "Email", free: 14, paid: 8 },
	{ label: "Direct", free: 17, paid: 10 },
	{ label: "Events", free: 11, paid: 5 },
];

export const SignupsBySource = ({ className }: SignupsBySourceProps) => {
	const [compare, setCompare] = React.useState(false);
	const series = [{ name: "Free" }];

	if (compare) series.push({ name: "Paid" });

	const data = sources.map(({ label, free, paid }) => ({
		label,
		values: compare ? [free, paid] : [free],
	}));

	return (
		<div className={cx("grid gap-3", className)}>
			<Button
				className="justify-self-start"
				type="button"
				variant="outline"
				aria-pressed={compare}
				onClick={() => setCompare(!compare)}
			>
				Compare paid signups
			</Button>
			<ChartBar
				label="Signups by source"
				series={series}
				data={data}
				stacked={false}
				valueFormatter={String}
			/>
		</div>
	);
};

Component ChartPie

Provide a name and value for each slice. Enable showLegend to display each slice as a percentage of the total.

import { ChartPie } from "nano-ux";

type SignupsByPlanProps = { className?: string };

export const SignupsByPlan = ({ className }: SignupsByPlanProps) => (
	<ChartPie
		className={className}
		label="Signups by plan"
		data={[
			{ name: "Free", value: 54 },
			{ name: "Pro", value: 30 },
			{ name: "Team", value: 16 },
		]}
		showLegend
		valueFormatter={String}
	/>
);

Component WorldMap

Use two-letter country codes and intensities from 0 to 100. Give the container an aspect ratio to preserve the map shape.

import cx from "clsx-tw";
import { WorldMap } from "nano-ux/charts/world-map";

type SignupsByCountryProps = { className?: string };

export const SignupsByCountry = ({ className }: SignupsByCountryProps) => (
	<div className={cx("aspect-[802/405] w-full", className)}>
		<WorldMap
			data={[
				{ country: "US", intensity: 100 },
				{ country: "IT", intensity: 60 },
			]}
		/>
	</div>
);

Component Table

Use Table for rows already loaded in memory. Use sortableColumns to choose which headers can sort. TypeScript checks columns, data, and getRowKey through TableProps. The component accepts these props directly. Use TableVirtual for infinite loading.

import { Table, type TableColumn } from "nano-ux";

type Profile = { id: string; name: string; visits: number };

const data: Profile[] = [
	{ id: "ada", name: "Ada", visits: 12 },
	{ id: "lin", name: "Lin", visits: 4 },
];

const columns: TableColumn<Profile>[] = [
	{ key: "name", header: "Name", render: (row) => row.name },
	{ key: "visits", header: "Visits", render: (row) => row.visits },
];

type ProfileTableProps = { className?: string };

export const ProfileTable = ({ className }: ProfileTableProps) => (
	<Table
		className={className}
		data={data}
		columns={columns}
		getRowKey={(row) => row.id}
		sortableColumns={["name", "visits"]}
		defaultSort={{ id: "name", direction: "asc" }}
	/>
);
Ada12
Lin4

Component TableVirtual

The preview loads 50 of 10,000 matching users per page. By default the table fits within the viewport height. It loads enough rows to allow scrolling, then requests more near the bottom. The example imports countProfiles and listProfiles from your application. Use Repository.count with the same filters as listProfiles. Pass sort to Repository.getem with limit and offset. A sortable header requests the first page in the new order.

import { createColumnHelper, TableVirtual, type tableVirtualFeatures, useInfiniteTable } from "nano-ux";
import useSWR from "swr";
import { countProfiles, listProfiles } from "./profiles-api";

type Profile = { name: string; email: string };
const column = createColumnHelper<typeof tableVirtualFeatures, Profile>();
const columns = column.columns([
  column.accessor("name", { header: "Name" }),
  column.accessor("email", { header: "Email" }),
]);

type ProfileListProps = { search: string; className?: string };

export const ProfileList = ({ search, className = "h-96" }: ProfileListProps) => {
  const { data: total } = useSWR(["profiles/count", search], () =>
    countProfiles({ search }),
  );

  const { tableKey, tableProps } = useInfiniteTable<Profile>({
    key: ["profiles", search],
    pageSize: 50,
    fetchPage: ({ offset, limit, sort }) => listProfiles({ search, offset, limit, sort }),
  });

  return (
    <TableVirtual
      key={tableKey}
      className={className}
      columns={columns}
      totalCount={total ?? null}
      {...tableProps}
    />
  );
};

Hooks

Hook useInViewOnce

Attach the ref to a visible element to mount its content the first time it enters the viewport.

import { useInViewOnce } from "nano-ux";

export const Activity = () => {
  const { ref, hasEnteredView } = useInViewOnce();

  return (
    <section ref={ref}>
      <h2>Activity</h2>
      {hasEnteredView && <p>Weekly activity is ready.</p>}
    </section>
  );
};

Functions

Function keysToDate

Format selected date fields in a copy of the record before submitting it.

import { keysToDate } from "nano-ux/helpers";

const profile = { birth_date: "1995-04-18T09:30:00" };
const format = keysToDate<typeof profile>(["birth_date"], "YYYY-MM-DD");

const payload = format(profile);
// { birth_date: "1995-04-18" }

Function initNavScroll

Call once at browser startup to restore the scroll position without animation on back and forward navigation.

import { initNavScroll } from "nano-ux/helpers";

initNavScroll();

Use Vite

React

npm install
npm install -D nano-ux
npm install -D vite @vitejs/plugin-react typescript @types/react @types/react-dom
vite.config.ts
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [react()],
});
tsconfig.json
{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "jsx": "react-jsx"
  }
}

Preact

npm install
npm install -D nano-ux preact
npm install -D vite @preact/preset-vite typescript
vite.config.ts
import preact from "@preact/preset-vite";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [preact()],
});
tsconfig.json
{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "jsx": "react-jsx",
    "jsxImportSource": "preact",
    "skipLibCheck": true,
    "paths": {
      "react": [
        "./node_modules/preact/compat"
      ],
      "react-dom": [
        "./node_modules/preact/compat"
      ],
      "react/jsx-runtime": [
        "./node_modules/preact/jsx-runtime"
      ]
    }
  }
}

Use "nano-ssg"

Pre-rendered React web application, made easy.
Built on vite, react, and tailwind.

npm install -D nano-ssg

Configure Vite

Start with an ESM project that has React 19, React DOM 19, Vite 8, and nano-ssg installed. Use the preset in vite.config.ts. It reads pages from src/views/ and supplies the HTML template and browser entry.

export { default } from "nano-ssg/config";

The default nano-ssg HTML template starts the client. If you provide your own index.html, include this script so the page becomes interactive.

<script type="module">import "virtual:ssg/client";</script>

Create a page

Create src/views/Home.page.tsx for the home page. Export a component named Page. The optional route.metadata.title sets the browser tab title.

export const route = { metadata: { title: "Welcome" } };

export const Page = () => (
  <main>
    <h1>Welcome</h1>
  </main>
);

Folders add URL segments. For example, src/views/guides/GettingStarted.page.tsx serves /guides/getting-started and builds to dist/guides/getting-started.html.

Build and preview

Run npx -y vite and open http://localhost:3000/ to see the home page. To check the production build, stop the development server and run these commands from the project root.

npx -y vite build
npx -y vite preview

Open the URL printed by Vite. The home page is in dist/index.html. Deploy the contents of dist/ to your static host.

Use "miral"

Like storybook, but opinionated, much simpler, and without interaction testing.
Built on vite, react, and tailwind.

npm install -D miral

Use the catalog

Open the component catalog and select a component in the sidebar. Select Playground, when available, to change its props and see the result.

Choose Desktop to fill the available preview width. Tablet uses a 768 × 1024 viewport and Smartphone uses 390 × 844. The toolbar also lets you switch themes or enter full screen. Press Esc to exit full screen.

Create a preview

In a React project with nano-ux and Miral installed, create SaveButton.mira.tsx. The filename sets the sidebar label. Export Preview to show the default example. The optional section string groups it in the sidebar.

import { Button } from "nano-ux";
import "nano-ux/theme.css";

export const section = "Controls";

export const Preview = () => <Button>Save</Button>;

Run and build

Use Node.js 24 or later. From the project directory, start the catalog and open http://localhost:9000/. Select SaveButton under Controls.

npx -y miral preview

To publish the catalog, build it into a separate output directory and serve that directory on a static host.

npx -y miral build --outDir dist/miral