Single component UI toolbox.
Comfortable, prop based styling combining the advantages of traditional and CSS-in-JS solutions into a single, flexible component.
- GitHub Trending Widget
- With shorthands
Paradigm shift
YouEye works differently than what you've got used to. It has close relations to inline styling solutions, such the css
prop, the style
prop, custom props and utility class based approaches.
- CSS as props
- Maintainability
- Style sharing
- Single component approach
Many UI solutions providing a subset of some CSS and/or CSS like properties. YouEye is all about CSS, it let's you use any CSS property.
Some libraries give you shorthands for some of the props. YouEye comes with optional shorthands for all CSS properties and values.
Create components for each elements separately: Button, Link and Card. How do you make an element Card, Button and Link at the same time? With a component based approach this can become messy, a component do not necessarily handle all cases children can be.
Using custom props your elements can become anything, the implementation of the props are up to you! This approach is closer to the way of using traditional CSS.
It is taught that separating concerns is a good practice. Markup and styles however are the same concern: Presentation.
Coupling markup with styles is not a new idea, it was how webpages were styled before CSS. HTML needed an interface to connect to this new technology: Selectors.
Maintaining selectors require rules, naming systems - which none them are flawless -, it forces new tools and workarounds to handle dynamic cases, but first and foremost: selectors make hard to understand the results by looking at the markup.
YouEye/inline styles/utility classes are removing this overhead. You can understand the layout immediately just by looking at the code, without the need to construct the possible outcome in your mind checking through multiple files and separate code segments. These are especially important if the codebase is managed by multiple members.
Not following/understanding the conventions/layout of a project correctly will cause frictions in the design-system. YouEye is getting rid of a lot of variables, improves consistency and enforces a less error prone approach.
Examples of handling dynamic cases
Class names
Styled Components
YouEye props
YouEye custom prop
YouEye uses a single component approach for all your markup needs. This makes usage easy and comfortable, and allows you to use all its features anywhere you want without extending functionalities of your custom component.
Super-charged by CCSS
CCSS is an opinionated, low level utility to deal with CSS style objects.
YouEye combines existing CSS-in-JS solutions with CCSS, extending them with new features and customization options to suit your own needs.
- Value maps
- Plugins
- Custom props
- Shorthands
You can assign value maps to any CSS or custom property your design system requires. Common use cases are colors, font sizes and dimensions.
YouEye gives you the freedom to implement your design system needs however it's most comfortable for you.
Enhance the functionality of existing properties by supporting new value types and/or special rules.
Good examples are CCSS's plugin-gutter
for consistent spacing, and plugin-ratio
to support the padding ratio "hack" out-of-the-box.
Add your own custom properties to share, compose, re-use styles, and design tokens. Create amazing new features living right inside your CSS.
Good examples are CCSS's prop-keyframes
to simplify animation creation, and prop-mq
to support prepared custom breakpoints instead of manually constructing them.
Many libraries offer some sort of shorthands for popular, frequently used cases. By CCSS shorthands are provided for all CSS properties and values.
Shorthands enable faster prototyping and development, and removes a lot of clutter from your screen. It is easy to get used to and get along with after a short period of time.
Shorthands are completely optional to use. It is a very opinionated approach, it's always up to the developer's/team's taste. You may also combine long names with short values for better readability.
Long names, long values
Long names, short values
Short names, short values
Static and Dynamic extraction
For increased performance YouEye supports static and dynamic extraction. @you-eye/babel-plugin-react will
- Extract styles into static CSS files;
- Convert component calls to native DOM elements with class names;
- Replace dynamic calls with CSS variables;
- Resolve constants at build time;
- Achieves Atomic CSS extraction strategy;
- Minify prop names and values.