Fysk Provider
The central nervous system of your application, providing global configuration for icons, animations, and consistent state for all Fysk components.
About Fysk Provider
The Fysk Provider is a crucial component that wraps your application or specific sections of it. It serves as the "Built-in state management" for Fysk components, creating a shared context that manages:
Global Icons: Defines a standard set of status icons (loading, success, error, etc.) used across all components.
Animation Control: Centralized animation configuration including durations, easings, and visual effects.
Configuration: Manages preferences like icon positioning needed by various inputs and displays.
Consistency: Ensures that every component behaves and looks uniform without repetitive prop passing.
Why is it Necessary?
In a modern, component-driven architecture, passing common assets (like icons or animation settings) to every single leaf component is inefficient and error-prone. The Fysk Provider solves this by injecting these dependencies from the top down.
This "better" approach means:
Instant Updates: Change an icon or animation timing in the provider, and it updates in every button, input, and alert across your app.
Clean API: Your component usage remains clean (e.g., just
<Button state="loading" />) because the component knows where to find the loading spinner.Performance: Optimized for speed, the provider ensures that heavy dependencies like animations are managed centrally.
Stateful Defaults: It comes pre-configured with Lucide React icons and professional animation timings, so you can start building beautiful UIs immediately.
Basic Setup
Create a client-side Providers component and wrap your root layout with it:
Animation Configuration
The animations prop gives you fine-grained control over how all Fysk components animate. All values have sensible defaults based on The Easing Blueprint.
Duration Presets
Control animation speed across your entire application:
| Key | Default | Use Case |
|---|---|---|
instant | 0.1s | Micro-interactions (hover, focus) |
fast | 0.15s | Quick feedback (button clicks) |
normal | 0.2s | Standard transitions (state changes) |
slow | 0.3s | Deliberate animations (modals) |
layout | 0.4s | Size/position changes (morphing) |
Easing Presets
Control the "feel" of animations. Based on The Easing Blueprint:
| Key | Default | Why |
|---|---|---|
enter | easeOut | Feels responsive—quick start, smooth end |
exit | easeOut | Clean exit without lingering |
layout | easeInOut | Natural acceleration/deceleration |
hover | easeOut | Instant response to user input |
linear | linear | For spinners, progress bars |
Effect Settings
Toggle and customize visual effects that are applied during transitions:
| Key | Default | Description |
|---|---|---|
blur | true | Enable blur during enter/exit |
blurAmount | 4 | Blur intensity in pixels |
scale | true | Enable scale during enter/exit |
scaleAmount | 0.95 | Scale amount (0.95 = 95%) |
slide | true | Enable slide during enter/exit |
slideDistance | 10 | Slide distance in pixels |
Icon Configuration
Override default icons and set global icon positioning:
See the useFyskAnimation Hook documentation for how components consume this configuration.
Built with đź’– | Created by Yashraj