Skip to main content

Solstice v1.0 is here!

Learn more

Integrating with an Existing Theme

This theme is designed to work seamlessly with other Tailwind CSS v4 templates by Cosmic Themes.

Required Steps

  1. Copy the src/docs folder from this theme to your existing project.

    Most items of this theme are located under the src/docs folder. So the first step is to simply copy this entire folder to your existing project (to keep the same folder structure at src/docs).

  2. Import the docs styles into your global css file.

    This can be done by adding the following line to your global.css file after the tailwind theme import:

    src/styles/global.css
    /* theme definition import */
    @import "./tailwind-theme.css";
    /* docs styles */
    @import "@/docs/styles/docs-global.css";
  3. Add the docs content collection to your site’s content collection config file.

    src/content.config.ts
    // other collections...
    const docsCollection = defineCollection({
    loader: glob({ pattern: "**/[^_]*{md,mdx}", base: "./src/docs/data/docs" }),
    schema: () =>
    z.object({
    title: z.string(),
    description: z.string().optional(),
    sidebar: z
    .object({
    label: z.string().optional(),
    order: z.number().optional(),
    badge: z
    .object({
    text: z.string(),
    variant: z.enum(["note", "tip", "caution", "danger", "info"]).default("note"),
    })
    .optional(),
    })
    .optional(),
    tableOfContents: z
    .object({
    minHeadingLevel: z.number().min(1).max(6).optional(),
    maxHeadingLevel: z.number().min(1).max(6).optional(),
    })
    .optional(),
    pagefind: z.boolean().optional(),
    mappingKey: z.string().optional(),
    draft: z.boolean().optional(),
    }),
    });
    export const collections = {
    // other collection....
    docs: docsCollection,
    };
  4. Add the mdx components to the AutoImport integration

    astro.config.mjs
    export default defineConfig({
    // other config options...
    integrations: [
    AutoImport({
    imports: [
    // other imports...
    "@/docs/components/mdx-components/Aside.astro",
    "@/docs/components/mdx-components/Badge.astro",
    "@/docs/components/mdx-components/Button.astro",
    "@/docs/components/mdx-components/Steps.astro",
    "@/docs/components/mdx-components/Tabs.astro",
    "@/docs/components/mdx-components/TabsContent.astro",
    "@/docs/components/mdx-components/TabsList.astro",
    "@/docs/components/mdx-components/TabsTrigger.astro",
    ],
    }),
    ],
    });
  5. Add the docs pages to your site.

    From the Solstice theme copy the whole src/pages/docs folder into your site’s src/pages/docs folder.

Optional Steps

Fonts

This theme uses the Geist and Geist Mono fonts by default. It is recommended to install the fonts locally from fontsource Geist and Geist Mono.

Then in your fonts.css file add the following:

src/styles/fonts.css
/* geist-latin-wght-normal */
@font-face {
font-family: "Geist Variable";
font-style: normal;
font-display: swap;
font-weight: 100 900;
src: url(@fontsource-variable/geist/files/geist-latin-wght-normal.woff2)
format("woff2-variations");
unicode-range:
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* geist-mono-latin-wght-normal */
@font-face {
font-family: "Geist Mono Variable";
font-style: normal;
font-display: swap;
font-weight: 100 900;
src: url(@fontsource-variable/geist-mono/files/geist-mono-latin-wght-normal.woff2)
format("woff2-variations");
unicode-range:
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

Alternate Fonts

You can also use different fonts. Just make sure you add the necessary fonts to your fonts.css file, and update the font-family property in your src/docs/styles/docs-global.css file.

Info

You should also preload your font in the src/docs/layouts/BaseHead.astro component, similar to the Geist fonts.

---
import GeistVariable from "@fontsource-variable/geist/files/geist-latin-wght-normal.woff2";
import GeistMonoVariable from "@fontsource-variable/geist-mono/files/geist-mono-latin-wght-normal.woff2";
---
<link rel="preload" href={GeistVariable} as="font" type="font/woff2" crossorigin="anonymous" />
<link rel="preload" href={GeistMonoVariable} as="font" type="font/woff2" crossorigin="anonymous" />