TastyCSS
A set of modules is for CSS-in-JS solution that includes state-to-style bindings, SRR and next-level developer experience. It includes a framework-agnostic implementation
Installation
Framework-agnostic version:
React version:
Documentation
TastyCSS utils allow generating performant CSS with responsiveness and style-to-state bindings.
TastyCSS React is a styled version for React Apps that uses styled-components
under-the-hood.
React
Let's look at styled API:
Now you can use this element inside your React App:
Customize styles in-place using styles
attribute:
Customize styles in context:
Responsive breakpoints
Customize responsive breakpoints:
This will create two breakpoints (1200px and 960px) which will split possible screen width into three zones: >=1200px, >=960px & <1200px, <960px.
Then you can create responsive styles with specific value for each zone:
Style-to-state bindings
Style-to-state binding works gracefully and allows to use logical operators:
You can use even more complex expressions with brackets. The algorithm will go from the last to the first expression trying to match every possible combination of modifiers. If the combination is matched then it applies the style value to that selector.
This documentation is work in progress. It is not yet ready.
Authors
- Andrey Yamanov (@tenphi)