You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose adding a new utility function makeVariantStyles to Griffel. This function would enable a variant-based styling approach similar to libraries like vanilla-extract and Panda CSS, allowing for more flexible and maintainable component styling.
Features
Create variant-based styles with a simple, declarative API
Support for compound variants
Default variants
Type-safe usage with TypeScript, including automatic prop type inference
Benefits
Improved Developer Experience: Simplifies the process of creating and managing component variants.
Type Safety: Leverages TypeScript for type-safe styling and prop usage.
Performance: Utilizes memoization to minimize unnecessary style recalculations.
Flexibility: Supports complex styling scenarios with compound variants and default variants.
Familiarity: API design inspired by popular libraries, reducing learning curve for developers.
The proposed implementation takes inspiration from these approaches while adapting to Griffel's unique architecture and capabilities. And it does not rely on Griffel's internal APIs, utilizing public API such as makeStyles and mergeClasses. Which allows multiple ways for integration - bake in directly into core, or create a standalone extension package.
I would greatly appreciate any feedback, suggestions, or concerns you might have about this proposal. Thank you!
The text was updated successfully, but these errors were encountered:
Overview
I'd like to propose adding a new utility function
makeVariantStyles
to Griffel. This function would enable a variant-based styling approach similar to libraries likevanilla-extract
andPanda CSS
, allowing for more flexible and maintainable component styling.Features
Benefits
Example Usage
Demo
A working demo of this proposed functionality can be found on StackBlitz:
View
makeVariantStyles
Demo on StackBlitzSimilar Implementations in Other Libraries
To provide context and allow for comparison, here are links to similar implementations in other popular styling libraries:
The proposed implementation takes inspiration from these approaches while adapting to Griffel's unique architecture and capabilities. And it does not rely on Griffel's internal APIs, utilizing public API such as
makeStyles
andmergeClasses
. Which allows multiple ways for integration - bake in directly into core, or create a standalone extension package.I would greatly appreciate any feedback, suggestions, or concerns you might have about this proposal. Thank you!
The text was updated successfully, but these errors were encountered: