Skip to content

We would like to use cookies to understand how this site is used. The site works the same either way. Privacy policy

DemoThis banner is a demo and part of the theme. This demo site sets no cookies and tracks nothing.

Theme documentation

Guides and architecture

How to set up the site, change its look, connect forms and publish it.

Architecture

How the theme is built

Static pages built with Astro 7 and Tailwind CSS 4. Content is checked against schemas, and a preset sets the design tokens.

  • Content collectionsChecked at build

    Typed content

    The fields at the top of every Markdown file are checked against a schema. A missing or invalid field stops the build with a message.

    src/content.config.ts
    import { defineCollection } from 'astro:content';
    import { glob } from 'astro/loaders';
    import { z } from 'astro/zod';
    
    export const docs = defineCollection({
      loader: glob({ pattern: '**/[^_]*.md', base: './src/content/docs' }),
      schema: z.object({
        title: z.string().min(1),
        description: z.string(),
        category: z.string(),
        order: z.number().default(100),
        draft: z.boolean().default(false),
      }),
    });
  • Search boxNo service

    Article filter

    Typing in the search box narrows the list of articles. It runs in the browser, with no outside service and no page reload.

    src/scripts/filter.ts
    export function initFilter(): void {
      const root = document.querySelector<HTMLElement>('[data-filter]');
      const input = root?.querySelector<HTMLInputElement>('[data-filter-input]');
      const items = document.querySelectorAll<HTMLElement>('[data-filter-item]');
    
      input?.addEventListener('input', () => {
        const words = input.value.toLowerCase().split(/\s+/).filter(Boolean);
        items.forEach((item) => {
          const text = (item.dataset.filterText ?? '').toLowerCase();
          item.hidden = !words.every((word) => text.includes(word));
        });
      });
    }
  • Theme configurationBuild time

    Presets and tokens

    A preset sets the accent, surfaces, borders, corners and glow. For any preset or override other than the shipped one, the values are written into each page as CSS custom properties at build time.

    src/theme.config.ts
    export const themeConfig: ThemeConfig = {
      preset: 'nightgrid',
      borders: 'preset',
      radius: 'preset',
      buttonShape: 'preset',
      colors: {
        primary: 'preset',
        background: 'preset',
      },
      glow: 'preset',
      typography: 'preset',
    };

All documentation

Guides and reference for Nightgrid.

Guides

6 articles

Architecture

1 article
  • Design system

    The few rules that keep everything in Nightgrid looking like one design, and where to find the full guide.

↑↓navigate↵openEscclose