# Project Setup

Set up shared styles, imports, and optional themes for your Zenos app.

Once your first component works, set up the defaults that every page will share. This guide covers where styles belong, how to import components, and what to check before building more screens.

Complete [Installation](/getting-started/installation/) first. Keep the files your framework created and add the settings you need below.

Set up once, use across your pages:

Start with shared styles and imports, then check them in your app.

1. **Load shared styles.** `Tailwind + Zenos CSS → index.css`. Load the package styles once, followed by your own rules.
2. **Use public imports.** `UI package → components, layouts, and hooks`. Use the package root. Installed recipes come from your local files.
3. **Check a real page.** `Styles + keyboard + theme + build`. Try the controls, check any theme changes, and build your app.

## 1. Keep styles in one place

Use `index.css` as the global stylesheet and keep all package CSS imports there. Your framework entry or root layout imports only this local file. The [Installation examples](/getting-started/installation/#connect-indexcss-to-your-framework) show the path for each framework.

For Tailwind CSS v4, start `src/index.css` with these imports, then add shared rules and theme overrides:

```css title="src/index.css"
@import "tailwindcss";
@import "@zentara-co/zenos-ui/tailwind.css";

body {
  margin: 0;
  background: var(--background-default);
  color: var(--text-default);
}
```

Load that file once from your application entry:

```tsx title="src/main.tsx (style import)"
import "./index.css";
```

Remove any direct Zenos CSS import from `.tsx` files. Loading CSS globally also styles menus and dialogs that appear outside the component that opened them.

<details>
<summary>My app does not use Tailwind CSS</summary>

Replace the two Tailwind imports with the compiled stylesheet import at the top of `index.css`:

```css title="src/index.css"
@import "@zentara-co/zenos-ui/styles.css";
```

Keep your shared rules below that import. Tailwind is optional with this setup.

</details>

### Troubleshoot IntelliSense

Tailwind CSS IntelliSense discovers a Tailwind v4 project through a CSS file that imports Tailwind. Zenos' `tailwind.css` entrypoint also exposes its theme and custom variants to the compiler and editor. Importing the compiled `styles.css` from a `.tsx` file does not provide that metadata.

If Zenos suggestions still do not appear:

1. Confirm that `tailwindcss` v4 is installed and configured in the application workspace, and the Tailwind CSS IntelliSense extension is enabled.
2. Confirm that `index.css` contains both `@import "tailwindcss"` and `@import "@zentara-co/zenos-ui/tailwind.css"`, and that your application entry loads this CSS file.
3. In VS Code or Cursor, run **Tailwind CSS: Show Output** and confirm that `index.css` was detected as the project entrypoint.

If automatic detection fails, set the CSS entrypoint explicitly:

```json title=".vscode/settings.json (setting to merge)"
{
  "tailwindCSS.experimental.configFile": "src/index.css"
}
```

Use your framework's actual `index.css` path. For multiple entrypoints, follow the [Tailwind CSS IntelliSense configuration guide](https://github.com/tailwindlabs/tailwindcss-intellisense#tailwindcssexperimentalconfigfile). You do not need to add Zenos package source to Tailwind's scan paths. Do not load the compiled `styles.css` and Tailwind-native `tailwind.css` entrypoints together.

## 2. Use the public imports

Components, layout helpers, hooks, and types come from the package root:

```tsx
import { Button, Stack, type ButtonProps } from "@zentara-co/zenos-ui";
```

Your editor can suggest props and report mistakes using the included TypeScript declarations. Use the component's docs to see its supported props. Package `src` paths and repository files are private implementation details.

Recipes, such as Calendar or Data Table, are different: the CLI copies their source into your app. Import a recipe from the local path printed by the installer. See the [CLI guide](/getting-started/cli/#add-a-recipe) when you need one.

### Bundle behavior

Zenos publishes unbundled ES modules so your bundler can remove components and utilities that your application does not import. The JavaScript modules are side-effect free. Use named imports from the package root:

```tsx
import { Button } from "@zentara-co/zenos-ui";
```

CSS files are intentionally marked as side effects so an explicit stylesheet import is preserved. Load either the compiled `@zentara-co/zenos-ui/styles.css` entrypoint or the Tailwind-native `@zentara-co/zenos-ui/tailwind.css` entrypoint once; do not load both. Importing a component does not inject styles or change global browser state.

<details>
<summary>Check my TypeScript settings</summary>

Keep your framework's generated configuration. In the config used by your app, enable strict checking if it is not already enabled:

```json title="tsconfig.json (setting to merge)"
{
  "compilerOptions": {
    "strict": true
  }
}
```

Merge this setting into the existing file. Preserve its `extends`, JSX settings, environment types, aliases, plugins, and project references. Some projects keep app settings in `tsconfig.app.json` or an inherited config.

Use the React 19 types that match your React installation. Modern framework templates already configure module resolution and JSX; a Zenos-specific TypeScript preset is not needed.

</details>

<details>
<summary>Where should I put my own files?</summary>

For a small Vite app, start with the files you use:

```text
src/
├── App.tsx          Your app's main component
├── components/      Components shared across pages
├── features/        Forms, data, and UI for each feature
├── index.css        Global styles and theme overrides
└── main.tsx         Existing React entry and index.css import
```

Keep your framework's route folders if it has them. Add folders when code needs a home; an empty folder for every possible concern is unnecessary.

In a monorepo, install Zenos in the app package that renders React. Keep feature-specific code beside that feature. See [File Organization](/getting-started/file-organization/) as your app grows.

</details>

## Optional: customize the theme

Zenos works with its default styles. Open the sections below if your app needs a theme switch or custom colors.

<details>
<summary>Add a light and dark theme switch</summary>

For a client-rendered React app, add this component to your header or settings page:

```tsx title="src/components/ThemeControl.tsx"
import { ThemeToggleButton } from "@zentara-co/zenos-ui";

export function ThemeControl() {
  return <ThemeToggleButton />;
}
```

The button changes the document theme and saves the preference under the storage key `theme`. Switch it, reload the page, and confirm the selected theme stays active.

For server-rendered apps, keep the root layout on the server and put interactive controls inside the framework's client boundary. Apply the initial theme in the document head before the page is painted to avoid a flash. Follow [Dark mode](/foundations/dark-mode/#prevent-a-theme-flash) for the initialization script and [useTheme](/hooks/use-theme/) for server-rendering considerations.

Use the same storage key in that script and every theme control. If your app already has a theme provider, pass its `theme` and `onThemeChange` values to `ThemeToggleButton`. That provider should apply the theme to the document and manage persistence.

</details>

<details>
<summary>Change the app's colors</summary>

Add token overrides to the `index.css` file that loads after Zenos. A token is a named CSS variable used by multiple components:

```css title="src/index.css (add below imports)"
:root {
  --background-default: #ffffff;
  --text-default: #171717;
  --border-default: rgb(23 23 23 / 10%);
}

:root.dark,
:root[data-theme="dark"] {
  --background-default: #101010;
  --text-default: #f5f5f5;
  --border-default: rgb(255 255 255 / 12%);
}
```

These variables change the page colors used in step 1 and components that use those same roles. Other surfaces and button variants have their own tokens. See [Theme customization](/foundations/tokens/) and [Colors](/foundations/colors/) for the full set.

Use tokens for changes shared across your app, and `className` or `style` for a local adjustment. Check text, borders, and focus indicators in both themes after changing colors.

</details>

<details>
<summary>Add an editable recipe</summary>

Preview a Calendar installation from your app's folder. The [CLI](/getting-started/cli/#start-here) runs directly without a project installation:

```bash
pnpm dlx @zentara-co/zenos-cli add calendar --dry-run
npx @zentara-co/zenos-cli add calendar --dry-run
yarn dlx @zentara-co/zenos-cli add calendar --dry-run
bunx @zentara-co/zenos-cli add calendar --dry-run
```

The preview reports the planned changes without modifying your app. When the destination and dependencies look right, run:

```bash
pnpm dlx @zentara-co/zenos-cli add calendar
npx @zentara-co/zenos-cli add calendar
yarn dlx @zentara-co/zenos-cli add calendar
bunx @zentara-co/zenos-cli add calendar
```

The CLI copies editable source and installs the recipe's extra dependencies. Use the local import path in its output. See [Calendar](/recipes/calendar/) for examples and the [CLI guide](/getting-started/cli/) for destination and overwrite options.

</details>

## 3. Check a real page

Use the [Quick Start form](/getting-started/quick-start/) or a page you have already built:

1. **Open the page:** buttons, inputs, and page text should be styled.
2. **Use the keyboard:** Tab between controls and check that focus is visible. Open a Select or Dialog and confirm its popup is styled too.
3. **If you added dark mode:** switch themes and reload. The selected theme should remain active; check a second tab if you use shared persistence.
4. **Run your app's checks:** type-check and build with the scripts in your `package.json`. If you installed a recipe, render it from its local path too.

If styles are missing, check the global import first. If a theme resets, check the storage key and which provider owns it. If an import fails, check the package installation and the documented export.

Continue with [File Organization](/getting-started/file-organization/) to organize your feature code, or [Layout composition](/layout/composition/) to build your next screen.

Source: https://zenos-ui.pages.dev/getting-started/project-setup/