Stoop
GitHub
/

createStoop

Create a Stoop instance with theme configuration

Usage

Important Convention: createStoop() must be called at module level in a file named stoop.theme.ts (or theme.ts). Required pattern:

// stoop.theme.ts (or theme.ts) - REQUIRED CONVENTION
import { createStoop } from "stoop";

const stoop = createStoop({
  theme: lightTheme,
  themes: {
    light: lightTheme,
    dark: darkTheme,
  },
});

// Export APIs throughout your app
export const { styled, css, Provider, useTheme, getCssText } = stoop;

Why this convention matters:

Parameters

ParameterTypeDescription
themeThemeBase theme object with design tokens
themesRecord<string, Theme>Object mapping theme names to theme objects (optional, enables Provider and useTheme)
mediaRecord<string, string>Media query breakpoints for responsive styles (optional; can also be defined in theme)
utilsRecord<string, UtilityFunction>Custom utility functions (optional)
prefixstringPrefix for CSS class names and variables (default: "stoop")
themeMapRecord<string, ThemeScale>Custom theme scale mapping (optional)
globalCssCSSGlobal styles to inject (optional; recommended over manual globalCss calls)

Returns

Returns a StoopInstance object with:

Core Functions

SSR Functions

Theme Management (only if themes config provided)

Properties