# vite-pages-theme-basic

> **This theme is deprecated. Please use vite-pages-theme-doc instead.**

Latest version **3.1.4** (published 2022-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-pages-theme-basic
pnpm add vite-pages-theme-basic
yarn add vite-pages-theme-basic
bun add vite-pages-theme-basic
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.1.4 |
| Published | 2022-06-13 |
| First published | 2020-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 463 |
| Maintainers | csr632 |
| Keywords | vite, react, vite-pages, react-pages, vite-plugin-react-pages |

## Links

- npm: https://www.npmjs.com/package/vite-pages-theme-basic
- Repository: https://github.com/vitejs/vite-plugin-react-pages
- Issues: https://github.com/vitejs/vite-plugin-react-pages/issues
- npm.io page: https://npm.io/package/vite-pages-theme-basic

## Dependencies (1)

- [github-markdown-css](https://npm.io/package/github-markdown-css.md) ^4.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.1.4 (latest) — 2022-06-13
- 0.8.0 (pnpm-temp) — 2020-07-31
- 0.6.0 (next) — 2020-07-18
- 3.1.3 — 2022-05-29
- 3.1.2 — 2022-01-11
- 3.1.0 — 2021-09-12
- 3.0.4 — 2021-06-14
- 3.0.3 — 2021-06-13
- 3.0.2 — 2021-06-13
- 3.0.1 — 2021-04-03
- 3.0.0 — 2021-04-02
- 2.0.4 — 2021-02-03
- 2.0.3 — 2021-01-25
- 2.0.2 — 2021-01-25
- 2.0.1 — 2021-01-08
- … 35 more at https://npm.io/package/vite-pages-theme-basic/versions

## README

# Basic theme

**This theme is deprecated. Please use vite-pages-theme-doc instead.**

`vite-pages-theme-basic` provides a nice theme. It should satisfy most users' needs. This document site is powered by this theme.

## How to use

You should config the theme in `_theme.tsx`:

```tsx
// _theme.tsx
import React from 'react'
import { createTheme } from 'vite-pages-theme-basic'

export default createTheme({
  topNavs: [
    { text: 'index', path: '/' },
    { text: 'Vite', href: 'https://github.com/vitejs/vite' },
  ],
  logo: 'Vite Pages',
  // Other configs...
})
```

[Here is a complete example](https://github.com/vitejs/vite-plugin-react-pages/tree/main/packages/playground/use-theme).

## Auto menu generation

Basic theme can generation a side navigation menu automatically, based on the pages information.

You can control the label and sorting of the nav menu, by notating these _page static data_:

- title
- sort (default value is 1)

For **markdown pages**, notate the static data like this:

```text
---
title: Basic Theme
order: 0.5
---

markdown content...
```

For **jsx/tsx pages**, notate the static data like this:

```js
/**
 * @title page1 title
 * @sort 1
 */

// js code....
```

## Page search

Basic theme also generate a search box automatically. It help readers to filter pages by their titles. As an example, you can find the search box at the topbar of this document site.

> You can turn off the auto-generated search box in the theme configs. You can also customize the topbar operations area.

## Theme configs

The `createTheme` exported by `vite-pages-theme-basic` accepts [these options](https://github.com/vitejs/vite-plugin-react-pages/blob/main/packages/theme-basic/src/index.tsx):

```ts
interface Option {
  /**
   * Take fully control of side nav menu.
   */
  sideMenuData?: SideMenuData[]
  /**
   * Navigation menu at top bar.
   */
  topNavs?: TopNavData[]
  /**
   * Logo area at top bar.
   */
  logo?: React.ReactNode
  /**
   * Operation area at top bar.
   */
  topbarOperations?: React.ReactNode
  /**
   * Footer area.
   */
  footer?: React.ReactNode
  /**
   * Enable search.
   * @default true
   */
  search?: boolean
}

export type SideMenuData = { text: string; path: string }

export type TopNavData =
  | {
      text: string
      /**
       * The url.
       * @example 'https://www.google.com/'
       */
      href: string
    }
  | {
      text: string
      /**
       * The path in the current webapp.
       * @example '/posts/hello-world'
       */
      path: string
    }
```

## Fully theme customization

If the basic theme doesn't satisfy your need, you can [create your own theme](https://vitejs.github.io/vite-plugin-react-pages/#/theme-customization).

> Contributions to [the basic theme](https://github.com/vitejs/vite-plugin-react-pages/tree/main/packages/theme-basic) are always welcomed.

---
_Source: https://npm.io/package/vite-pages-theme-basic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
