---
description: "Replace the starter counter with an Adwaita window whose strings are ready for translation."
---

# Create a Window

Replace the starter counter with the Notes window: an Adwaita window with a header bar and an empty state.

## The project

[Project structure](/guide/getting-started#project-structure) describes the project's files.

The scaffold's starter test, `tests/app.test.tsx`, looks for the counter's Increment button and imports a default export that the new `src/app.tsx` doesn't have, so `npm run typecheck` would fail. Delete it; [Test the App](/tutorial/testing) writes the app's tests.

```bash
rm tests/app.test.tsx
```

## Mark strings for translation

Install `@gtkx/i18n`:

```bash
npm install @gtkx/i18n
```

Until [Translate the App](/tutorial/internationalization) adds catalogs, every `t("…")` shows its source text. Pass `t` a string literal, as every chapter does, so that GTKX can extract the message; [Keep messages extractable](/guide/internationalization#keep-messages-extractable) lists the forms it reads.

## The application window

Replace `src/app.tsx`:

```tsx [src/app.tsx]
import { useTranslation } from "@gtkx/i18n";
import {
    AdwApplication,
    AdwApplicationWindow,
    AdwHeaderBar,
    AdwStatusPage,
    AdwToolbarView,
} from "@gtkx/jsx/adw";
import { quit } from "@gtkx/react";

export const App = () => {
    const { t } = useTranslation();

    return (
        <AdwApplication>
            <AdwApplicationWindow
                title={t("Notes")}
                widthRequest={360}
                heightRequest={294}
                onCloseRequest={quit}
            >
                <AdwToolbarView top={<AdwHeaderBar />}>
                    <AdwStatusPage
                        iconName="document-new-symbolic"
                        title={t("No Notes")}
                        description={t(
                            "Notes are Markdown files in your notes folder",
                        )}
                    />
                </AdwToolbarView>
            </AdwApplicationWindow>
        </AdwApplication>
    );
};
```

Elements come from `@gtkx/jsx/<namespace>`, one module per library, and take the native class's properties and signals as camelCase props; [JSX Elements](/guide/jsx-elements) has the rules.

- `AdwApplication` creates the application with the ID from `gtkx.config.ts` and renders its children once it activates.
- `AdwApplicationWindow` is the main window. `widthRequest` and `heightRequest` set the smallest size it shrinks to, 360 by 294, the size the [GNOME HIG](https://developer.gnome.org/hig/guidelines/adaptive.html) asks phone-friendly apps to support. `quit()` from `@gtkx/react` unmounts the app and quits when the window closes.
- `AdwToolbarView` places bars around its content. Its `top` slot holds an `AdwHeaderBar`, which shows the window title and the close button.
- `AdwStatusPage` is the empty state, a [placeholder page](https://developer.gnome.org/hig/patterns/feedback/placeholders.html) with a symbolic icon, a title and a description.

## Run it

Save `src/app.tsx`. Its imports changed, so `gtkx dev` restarts the app instead of refreshing it, and the window shows the empty state.

<figure class="result">
    <img class="result-light" src="/figures/tutorial-your-first-window-light.png" width="360" height="343" loading="lazy" alt="The Notes window: a header bar titled Notes above a status page with a new-document icon, the title No Notes, and the description Notes are Markdown files in your notes folder." />
    <img class="result-dark" src="/figures/tutorial-your-first-window-dark.png" width="360" height="343" loading="lazy" alt="The Notes window: a header bar titled Notes above a status page with a new-document icon, the title No Notes, and the description Notes are Markdown files in your notes folder." />
    <figcaption>Captured from <a href="#the-application-window"><code>src/app.tsx</code></a> above.</figcaption>
</figure>

Run `npm run typecheck`. It passes once the starter test is gone.
