Shared Props

Every Toffee component extends ToffeeBaseProps, giving you a consistent API across all interactions.

PropTypeDefaultDescription
variant'default' | 'soft' | 'strong''default'Visual style. soft = reduced opacity, strong = high contrast.
speed'slow' | 'normal' | 'fast' | number'normal'Animation duration. slow=2000ms, normal=1200ms, fast=600ms. Pass a number for exact ms.
tone'neutral' | 'brand' | 'muted''neutral'Color palette applied via CSS variables. Overridable through ToffeeProvider theme.
reducedMotionboolean | 'auto''auto''auto' respects the OS prefers-reduced-motion setting. true/false force the behavior.
classNamestring—Additional CSS class applied to the root element.
styleReact.CSSProperties—Inline styles applied to the root element.
asReact.ElementTypecomponent-specificRender the root as a different HTML element or React component.

Render Slots

All components accept a slots prop with three standard slots:

PropTypeDefaultDescription
slots.beforeReactNode—Rendered before the main content.
slots.afterReactNode—Rendered after the main content.
slots.overlay(state) => ReactNode—Render prop that receives the component live state (progress, done, loaded, etc.).
tsx
// Slots example
<ShimmerText
  tone="brand"
  slots={{
    before: <Icon name="sparkle" />,
    after: <Badge>AI</Badge>,
    overlay: ({ isAnimating }) =>
      isAnimating ? <Spinner /> : null,
  }}
>
  Generating...
</ShimmerText>

Design Tokens

Tokens are exported from the server-safe entry point for use in custom components.

Speed

slow
2000ms
normal
1200ms
fast
600ms

Easing

smooth
cubic-bezier(0.4, 0, 0.6, 1)
enter
cubic-bezier(0.0, 0.0, 0.2, 1)
exit
cubic-bezier(0.4, 0, 1, 1)
spring
cubic-bezier(0.34, 1.56, 0.64, 1)
linear
linear