unocss-community/unocss-preset-shadcn

Expose types to typescript

Open

#28 opened on Jun 10, 2025

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (17 forks)github user discovery
good first issue

Repository metrics

Stars
 (391 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

It would be amazing if you could expose the types to typescript.

Currently, if you do something like:

import {presetShadcn} from "unocss-preset-shadcn";

const shadcnColors = {
    name: 'test',
    light: {
        // ...
    },
    dark: {
        // ...
    }
};

export default defineConfig({
    // ...
    presets: [
        // ...
        presetShadcn(
            {
                color: shadcnColors,
            }
        )
    ],
    // ...
});

typescript will present an error.

the best way to fix this would be if unocss-preset-shadcn exported types like ThemeCSSVarsVariant or ShadcnThemeColor so you could do:


import {presetShadcn, ThemeCSSVarsVariant} from "unocss-preset-shadcn";

const shadcnColors = {
    name: 'test',
    light: {
        // ...
    },
    dark: {
        // ...
    }
} satisfies ThemeCSSVarsVariant;

export default defineConfig({
    // ...
    presets: [
        // ...
        presetShadcn(
            {
                color: shadcnColors,
            }
        )
    ],
    // ...
});

Contributor guide