@volverjs/style
Version:
@volverjs/style is a lightweight responsive CSS utility library to accompany @volverjs/ui-* and static webpages as well.
155 lines (111 loc) • 3.95 kB
Markdown
<div align="center">
[](https://volverjs.github.io/style)
## /style
`backgrounds` `border` `colors` `aspect ratios` `typography`\
`easings` `animations` `sizes` `borders` `z-indexes` `media-queries`\
`layout` `spacing` `flexbox` `grid` `custom properties` `scss`
[](https://sonarcloud.io/summary/new_code?id=volverjs_style) [](https://sonarcloud.io/summary/new_code?id=volverjs_style) [](https://sonarcloud.io/summary/new_code?id=volverjs_style) [](https://depfu.com) [](https://depfu.com/github/volverjs/style?project_id=38570)
<br>
maintained with ❤️ by
<br>
[](https://8wave.it)
<br>
</div>
## Install
```bash
# pnpm
pnpm add /style
# yarn
yarn add /style
# npm
npm i -s /style
```
## Usage
```scss
/* css */
'/style';
/* scss */
'/style/scss';
```
or cherry pick what you want
```scss
/* css */
'/style/reset';
'/style/props/layout';
'/style/utilities/layout';
'/style/components/vv-button';
/* scss */
'/style/scss/reset';
'/style/scss/props/layout';
'/style/scss/utilities/layout';
'/style/scss/components/vv-button';
```
## Principles
### 👌 Zero Specificity
Everything is defined with *:where()* so you can override all definitions easily.
### 🎨 Custom properties
All attributes have a [custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/--*) (CSS variables) for easy theming.
### 😱 Utility-first + BEM
You can style utility-first (with [tailwindcss](https://tailwindcss.com) syntax) and use components (*vv-\** for ex. *vv-button*) written with [BEM](http://getbem.com/introduction/).
## Basic personalization
### Custom props
```css
'/style';
url('https://fonts.googleapis.com/css2?family=Open+Sans');
:root {
/* custom color brand */
--color-brand-hue: 149deg;
--color-brand-saturation: 56%;
--color-brand-lightness: 53%;
/* custom font sans */
--font-sans: 'Open Sans', sans-serif;
}
```
### SCSS
```scss
'/style/scss/context' with (
// custom color brand
$color-brand: #45cb85,
//custom font sans
$font-family-sans: 'Open Sans', sans-serif
);
'/style/scss';
url('https://fonts.googleapis.com/css2?family=Open+Sans');
```
## Deep override
All components are written through SCSS maps.
Root attributes style the component, submaps *state*, *element*, and *modifier* generates BEM selectors.
```scss
'sass:map';
// import volverjs default settings, functions and mixins
'/style/scss/context';
// override vv-button map
context.$vv-button: map.deep-merge(
context.$vv-button,
(
// change default button background
background: #ddd,
state: (
hover: (
// change default button background on hover
background: #aaa
)
),
modifier: (
// add a custom modifier
my-error: (
background: red
)
)
)
);
// import volverjs style
'/style/scss';
```
```html
<button type="button" class="vv-button vv-button--my-error">Error</button>
```
## Documentation
To learn more about `/style`, check [its documentation](https://volverjs.github.io/style).
## License
[MIT](http://opensource.org/licenses/MIT)