API Reference

Complete reference for all Shimmer component props and configuration options.

Shimmer Component Props

PropTypeDefaultDescription
loadingbooleantrueWhether to show shimmer effect or actual content
childrenComponent ChildrenrequiredThe content to render/measure (Slot/Children)
shimmerColorstring'rgba(255,255,255,0.15)'Color of the shimmer wave
backgroundColorstring'rgba(255,255,255,0.08)'Background color of shimmer blocks
durationnumber1.5Animation duration in seconds
fallbackBorderRadiusnumber4Border radius (px) for elements with no CSS border-radius
templatePropsRecord<string, unknown>-Props to inject into first child for skeleton rendering

Example with All Props

<Shimmer
  loading={isLoading}
  shimmerColor="rgba(255, 255, 255, 0.2)"
  backgroundColor="rgba(255, 255, 255, 0.1)"
  duration={2}
  fallbackBorderRadius={8}
  templateProps={{
    user: userTemplate,
    settings: settingsTemplate,
  }}
>
  <MyComponent user={user || userTemplate} settings={settings} />
</Shimmer>

Global Configuration

All frameworks support global configuration through their respective context/provider patterns.

React

import { ShimmerProvider } from '@shimmer-from-structure/react';

<ShimmerProvider config={{ shimmerColor: '...', ... }}>
  <App />
</ShimmerProvider>

Vue

import { provideShimmerConfig } from '@shimmer-from-structure/vue';

provideShimmerConfig({ shimmerColor: '...', ... });

Svelte

import { setShimmerConfig } from '@shimmer-from-structure/svelte';

setShimmerConfig({ shimmerColor: '...', ... });

Angular

import { provideShimmerConfig } from '@shimmer-from-structure/angular';

bootstrapApplication(AppComponent, {
  providers: [provideShimmerConfig({ shimmerColor: '...', ... })],
});

SolidJS

import { ShimmerProvider } from '@shimmer-from-structure/solid';

<ShimmerProvider config={{ shimmerColor: '...', ... }}>
  <App />
</ShimmerProvider>

Configuration Object

PropertyTypeDefaultDescription
shimmerColorstring'rgba(255,255,255,0.15)'Global shimmer wave color
backgroundColorstring'rgba(255,255,255,0.08)'Global background color for shimmer blocks
durationnumber1.5Global animation duration in seconds
fallbackBorderRadiusnumber4Global fallback border radius in pixels

Accessing Configuration

Each framework provides a way to access the current configuration:

  • React: useShimmerConfig()
  • Vue: useShimmerConfig()
  • Svelte: getShimmerConfig()
  • Angular: injectShimmerConfig()
  • SolidJS: useShimmerConfig()

TypeScript Support

All packages include full TypeScript definitions. Import types as needed:

import type { ShimmerProps, ShimmerConfig } from 'shimmer-from-structure';