StyleKit is a comprehensive, modular SCSS design system that provides a consistent foundation for building modern web applications. It includes a complete set of design tokens, utility classes, typography scales, color palettes, spacing systems, and animations. Built with CSS Modules support, StyleKit ensures style encapsulation while maintaining flexibility for customization.
Unlike Tailwind or Bootstrap, StyleKit focuses on developer-centric architecture rather than being a rigid framework or library. I would encourage you to use StyleKit as a starting point for your own design system, and then customize it to fit your needs.
Install StyleKit from npm:
npm install @san-siva/stylekitOr using yarn:
yarn add @san-siva/stylekitStyleKit is organized into specialized modules, each handling a specific aspect of your design system:
colors.module.scsstypography.module.scssutils.module.scssdimensions.module.scssanimations.module.scssglobals.scssImport the main module to access all design tokens and utilities:
@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
.my-component {
color: stylekit.$color--primary;
padding: stylekit.space(2);
font-size: stylekit.$font-size--h3;
}For better performance and explicit dependencies, import only what you need:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
background-color: colors.$color--base;
border: 1px solid colors.$color--border;
padding: utils.space(3);
border-radius: utils.rem(8);
}Import utility classes in your component or globally:
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function MyComponent() {
return (
<div className={styles['margin-bottom--3']}>
<h1 className={styles['font-size--h1']}>Title</h1>
<p className={styles['margin-top--2']}>Content</p>
</div>
);
}Provides a comprehensive color palette with semantic naming and variants.
$color--primary, $color--primary-light, $color--primary-lighter$color--primary-accent, $color--primary-accent-light, $color--primary-accent-lighter$color--secondary, $color--secondary-light, $color--secondary-lighter$color--base, $color--surface, $color--code$color--grey-light, $color--grey-medium, $color--grey-dark, $color--grey-darker$color--error, $color--error-light, $color--link$color--primary#4242fa$color--primary-lightrgba(66, 66, 250, 0.05)$color--primary-lighterrgba(66, 66, 250, 0.02)$color--primary-accent#fed600$color--primary-accent-light#fef1c4$color--primary-accent-lighter#fef8e0$color--secondary#3dad84$color--secondary-light#ecf7f3$color--secondary-lighter#f2f9f7$color--base#ffffff$color--surface#f6f6f6$color--code#e8f1fc$color--grey-light#e1e5e9$color--grey-medium#c6c6c7$color--grey-dark#6b7c93$color--grey-darker#4f5969$color--error#ff4232$color--error-light#ffecea$color--link#0d6efd$color--dark#313030$color--black#000Example usage:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
.button--primary {
background-color: colors.$color--primary;
color: colors.$color--base;
&:hover {
background-color: colors.$color--primary-light;
}
}
.alert--error {
background-color: colors.$color--error-light;
border-left: 3px solid colors.$color--error;
color: colors.$color--dark;
}Defines a consistent typographic scale with font families, sizes, weights, and line heights.
Font Families:
$font-family--primary$font-family--secondary$font-family--codeFont Sizes:
$font-size--very-large.font-size--very-large$font-size--large.font-size--large$font-size--h1.font-size--h1$font-size--h2.font-size--h2$font-size--h3.font-size--h3$font-size--h4.font-size--h4$font-size--h5.font-size--h5$font-size--h6.font-size--h6$font-size--p.font-size--p$font-size--small.font-size--smallFont Weights:
$font-weight--400.font-weight--400$font-weight--500.font-weight--500$font-weight--600.font-weight--600$font-weight--700.font-weight--700$font-weight--800.font-weight--800Line Heights:
$line-height--large$line-height--normal$line-height--small$line-height--very-smallExample usage:
@use '@san-siva/stylekit/styles/typography.module.scss' as type;
.heading {
font-family: type.$font-family--secondary;
font-size: type.$font-size--h2;
font-weight: type.$font-weight--700;
line-height: type.$line-height--small;
}
.body-text {
font-family: type.$font-family--primary;
font-size: type.$font-size--p;
line-height: type.$line-height--normal;
}Using utility classes in React/JSX:
import styles from '@san-siva/stylekit/styles/typography.module.scss';
<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
Welcome
</h1>Provides utility functions and a comprehensive spacing system.
Utility Functions:
rem($px)em($px)space($n, $useEm)Spacing Scale:
Spacing Utility Classes:
Auto-generated margin and padding utilities for all sides (top, bottom, left, right):
.margin-top--0 through .margin-top--9
.margin-bottom--0 through .margin-bottom--9
.margin-left--0 through .margin-left--9
.margin-right--0 through .margin-right--9
.padding-top--0 through .padding-top--9
.padding-bottom--0 through .padding-bottom--9
.padding-left--0 through .padding-left--9
.padding-right--0 through .padding-right--9All spacing utility classes are also available with !important modifiers to override other styles when needed.
Example usage with functions:
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
padding: utils.space(3); // 24px (1.5rem)
margin-bottom: utils.space(4); // 32px (2rem)
border-radius: utils.rem(8); // 0.5rem
.card-header {
margin-bottom: utils.space(2); // 16px (1rem)
font-size: utils.rem(20); // 1.25rem
}
}Example usage with utility classes:
import styles from '@san-siva/stylekit/styles/utils.module.scss';
<div className={styles['padding-top--4']}>
<h2 className={styles['margin-bottom--2']}>Section Title</h2>
<p className={styles['margin-bottom--3']}>Content here</p>
</div>Provides pre-built keyframe animations for common UI patterns.
loading_animationMoveInTopfadeInDownfadeUpExample usage:
@use '@san-siva/stylekit/styles/animations.module.scss';
.modal-enter {
animation: MoveInTop 0.3s ease-out;
}
.notification {
animation: fadeInDown 0.4s ease-out;
}
.loading-bar {
animation: loading_animation 4s linear infinite;
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
}Defines layout containers, page structures, border radius values, and responsive breakpoints.
Container System:
.container {
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 18px;
min-height: calc(100% - 36px);
width: calc(100% - 36px);
}
.container--contents-centered {
justify-content: center;
align-items: center;
}
.container--no-padding {
padding: 0;
}Page Layout:
.page {
--topbar-height: 80px;
max-width: 1216px;
margin: 0 auto;
padding: 48px calculated-sides;
// Responsive padding and width management
// Automatically adjusts for mobile, tablet, and desktop
}
.page--contents-max-width {
> * {
max-width: 780px;
}
}
.page--no-extra-padding {
--width-sections: calc(100% - 32px);
--padding-sections-left: 32px;
}Border Radius Scale:
$border-radius$border-radius--1$border-radius--1-5$border-radius--2$border-radius--3$border-radius--4Responsive Breakpoints:
The dimensions module automatically applies responsive padding adjustments at each breakpoint. The .page class uses CSS custom properties to maintain consistent spacing across different screen sizes.
@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
.card {
border-radius: dims.$border-radius--2;
max-width: dims.$max-width--page-contents;
}
.rounded-button {
border-radius: dims.$border-radius--1;
}
// Use built-in container
.my-container {
@extend .container;
@extend .container--contents-centered;
}Follow these guidelines to get the most out of StyleKit:
Use namespaces to avoid conflicts:
// Good: Use namespaces with @use
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.component {
color: colors.$color--primary;
padding: utils.space(2);
}
// Avoid: @import mixes everything into global scope
@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do thisAlways use the spacing scale:
// Good: Use spacing scale
.section {
margin-bottom: utils.space(4); // 32px from scale
padding: utils.space(3); // 24px from scale
}
// Avoid: Arbitrary values break consistency
.section {
margin-bottom: 35px; // Don't do this
padding: 22px; // Don't do this
}Use semantic color names:
// Good: Semantic naming makes intent clear
.error-message {
color: colors.$color--error;
background: colors.$color--error-light;
}
.primary-button {
background: colors.$color--primary;
color: colors.$color--base;
}
// Avoid: Direct hex values lose semantic meaning
.error-message {
color: #ff4232; // What does this color represent?
}Stick to the type scale:
// Good: Use predefined sizes
h1 {
font-size: type.$font-size--h1; // 36px
}
.small-text {
font-size: type.$font-size--small; // 12px
}
// Avoid: Random font sizes
h1 {
font-size: 37px; // Why not 36px from the scale?
}Combine utility classes effectively:
// Good: Compose utilities for rapid development
<div className={`
${styles['margin-bottom--4']}
${styles['padding-top--3']}
${styles['font-size--h2']}
`}>
Content
</div>
// Also good: Use SCSS variables for complex components
.complex-component {
margin-bottom: utils.space(4);
padding-top: utils.space(3);
font-size: type.$font-size--h2;
color: colors.$color--primary;
}// Import SCSS module
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function Card({ children }) {
return (
<div className={styles['padding-top--4']}>
<h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
Card Title
</h2>
<div className={styles['margin-top--3']}>
{children}
</div>
</div>
);
}<template>
<div :class="$style['padding-top--4']">
<h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
Card Title
</h2>
</div>
</template>
<style module>
@use '@san-siva/stylekit/styles/index.module.scss' as *;
</style>// component.scss
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
:host {
display: block;
padding: utils.space(4);
}
.card {
background: colors.$color--base;
border: 1px solid colors.$color--border;
}While StyleKit provides sensible defaults, you can customize it for your needs:
// your-colors.scss
@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
// Add your custom colors
$color--brand: #your-color;
$color--custom: #another-color;
// Use both StyleKit and custom colors
.my-component {
background: stylekit-colors.$color--primary;
border-color: $color--brand;
}@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
// Define custom spacing
$spacing-custom: utils.rem(72);
.special-section {
margin-bottom: $spacing-custom;
// Or use the built-in space function
padding: utils.space(5); // 40px
}@use '@san-siva/stylekit/styles/typography.module.scss' as type;
// Override with your font
$custom-font-family: 'Your Font', sans-serif;
.heading {
font-family: $custom-font-family;
// But still use StyleKit's scale
font-size: type.$font-size--h1;
font-weight: type.$font-weight--700;
}Import only what you need: StyleKit's modular architecture allows you to import specific modules rather than the entire library, reducing your bundle size.
// Smaller bundle: Import specific modules
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
// vs.
// Larger bundle: Import everything
@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;Utility classes vs. SCSS variables:
If you're migrating from a custom design system or another framework:
Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeThis project is licensed under the MIT License.
Author: Santhosh Siva
GitHub: https://github.com/san-siva
StyleKit is a comprehensive, modular SCSS design system that provides a consistent foundation for building modern web applications. It includes a complete set of design tokens, utility classes, typography scales, color palettes, spacing systems, and animations. Built with CSS Modules support, StyleKit ensures style encapsulation while maintaining flexibility for customization.
Unlike Tailwind or Bootstrap, StyleKit focuses on developer-centric architecture rather than being a rigid framework or library. I would encourage you to use StyleKit as a starting point for your own design system, and then customize it to fit your needs.
Install StyleKit from npm:
npm install @san-siva/stylekitOr using yarn:
yarn add @san-siva/stylekitStyleKit is organized into specialized modules, each handling a specific aspect of your design system:
colors.module.scsstypography.module.scssutils.module.scssdimensions.module.scssanimations.module.scssglobals.scssImport the main module to access all design tokens and utilities:
@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
.my-component {
color: stylekit.$color--primary;
padding: stylekit.space(2);
font-size: stylekit.$font-size--h3;
}For better performance and explicit dependencies, import only what you need:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
background-color: colors.$color--base;
border: 1px solid colors.$color--border;
padding: utils.space(3);
border-radius: utils.rem(8);
}Import utility classes in your component or globally:
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function MyComponent() {
return (
<div className={styles['margin-bottom--3']}>
<h1 className={styles['font-size--h1']}>Title</h1>
<p className={styles['margin-top--2']}>Content</p>
</div>
);
}Provides a comprehensive color palette with semantic naming and variants.
$color--primary, $color--primary-light, $color--primary-lighter$color--primary-accent, $color--primary-accent-light, $color--primary-accent-lighter$color--secondary, $color--secondary-light, $color--secondary-lighter$color--base, $color--surface, $color--code$color--grey-light, $color--grey-medium, $color--grey-dark, $color--grey-darker$color--error, $color--error-light, $color--link$color--primary#4242fa$color--primary-lightrgba(66, 66, 250, 0.05)$color--primary-lighterrgba(66, 66, 250, 0.02)$color--primary-accent#fed600$color--primary-accent-light#fef1c4$color--primary-accent-lighter#fef8e0$color--secondary#3dad84$color--secondary-light#ecf7f3$color--secondary-lighter#f2f9f7$color--base#ffffff$color--surface#f6f6f6$color--code#e8f1fc$color--grey-light#e1e5e9$color--grey-medium#c6c6c7$color--grey-dark#6b7c93$color--grey-darker#4f5969$color--error#ff4232$color--error-light#ffecea$color--link#0d6efd$color--dark#313030$color--black#000Example usage:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
.button--primary {
background-color: colors.$color--primary;
color: colors.$color--base;
&:hover {
background-color: colors.$color--primary-light;
}
}
.alert--error {
background-color: colors.$color--error-light;
border-left: 3px solid colors.$color--error;
color: colors.$color--dark;
}Defines a consistent typographic scale with font families, sizes, weights, and line heights.
Font Families:
$font-family--primary$font-family--secondary$font-family--codeFont Sizes:
$font-size--very-large.font-size--very-large$font-size--large.font-size--large$font-size--h1.font-size--h1$font-size--h2.font-size--h2$font-size--h3.font-size--h3$font-size--h4.font-size--h4$font-size--h5.font-size--h5$font-size--h6.font-size--h6$font-size--p.font-size--p$font-size--small.font-size--smallFont Weights:
$font-weight--400.font-weight--400$font-weight--500.font-weight--500$font-weight--600.font-weight--600$font-weight--700.font-weight--700$font-weight--800.font-weight--800Line Heights:
$line-height--large$line-height--normal$line-height--small$line-height--very-smallExample usage:
@use '@san-siva/stylekit/styles/typography.module.scss' as type;
.heading {
font-family: type.$font-family--secondary;
font-size: type.$font-size--h2;
font-weight: type.$font-weight--700;
line-height: type.$line-height--small;
}
.body-text {
font-family: type.$font-family--primary;
font-size: type.$font-size--p;
line-height: type.$line-height--normal;
}Using utility classes in React/JSX:
import styles from '@san-siva/stylekit/styles/typography.module.scss';
<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
Welcome
</h1>Provides utility functions and a comprehensive spacing system.
Utility Functions:
rem($px)em($px)space($n, $useEm)Spacing Scale:
Spacing Utility Classes:
Auto-generated margin and padding utilities for all sides (top, bottom, left, right):
.margin-top--0 through .margin-top--9
.margin-bottom--0 through .margin-bottom--9
.margin-left--0 through .margin-left--9
.margin-right--0 through .margin-right--9
.padding-top--0 through .padding-top--9
.padding-bottom--0 through .padding-bottom--9
.padding-left--0 through .padding-left--9
.padding-right--0 through .padding-right--9All spacing utility classes are also available with !important modifiers to override other styles when needed.
Example usage with functions:
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
padding: utils.space(3); // 24px (1.5rem)
margin-bottom: utils.space(4); // 32px (2rem)
border-radius: utils.rem(8); // 0.5rem
.card-header {
margin-bottom: utils.space(2); // 16px (1rem)
font-size: utils.rem(20); // 1.25rem
}
}Example usage with utility classes:
import styles from '@san-siva/stylekit/styles/utils.module.scss';
<div className={styles['padding-top--4']}>
<h2 className={styles['margin-bottom--2']}>Section Title</h2>
<p className={styles['margin-bottom--3']}>Content here</p>
</div>Provides pre-built keyframe animations for common UI patterns.
loading_animationMoveInTopfadeInDownfadeUpExample usage:
@use '@san-siva/stylekit/styles/animations.module.scss';
.modal-enter {
animation: MoveInTop 0.3s ease-out;
}
.notification {
animation: fadeInDown 0.4s ease-out;
}
.loading-bar {
animation: loading_animation 4s linear infinite;
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
}Defines layout containers, page structures, border radius values, and responsive breakpoints.
Container System:
.container {
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 18px;
min-height: calc(100% - 36px);
width: calc(100% - 36px);
}
.container--contents-centered {
justify-content: center;
align-items: center;
}
.container--no-padding {
padding: 0;
}Page Layout:
.page {
--topbar-height: 80px;
max-width: 1216px;
margin: 0 auto;
padding: 48px calculated-sides;
// Responsive padding and width management
// Automatically adjusts for mobile, tablet, and desktop
}
.page--contents-max-width {
> * {
max-width: 780px;
}
}
.page--no-extra-padding {
--width-sections: calc(100% - 32px);
--padding-sections-left: 32px;
}Border Radius Scale:
$border-radius$border-radius--1$border-radius--1-5$border-radius--2$border-radius--3$border-radius--4Responsive Breakpoints:
The dimensions module automatically applies responsive padding adjustments at each breakpoint. The .page class uses CSS custom properties to maintain consistent spacing across different screen sizes.
@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
.card {
border-radius: dims.$border-radius--2;
max-width: dims.$max-width--page-contents;
}
.rounded-button {
border-radius: dims.$border-radius--1;
}
// Use built-in container
.my-container {
@extend .container;
@extend .container--contents-centered;
}Follow these guidelines to get the most out of StyleKit:
Use namespaces to avoid conflicts:
// Good: Use namespaces with @use
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.component {
color: colors.$color--primary;
padding: utils.space(2);
}
// Avoid: @import mixes everything into global scope
@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do thisAlways use the spacing scale:
// Good: Use spacing scale
.section {
margin-bottom: utils.space(4); // 32px from scale
padding: utils.space(3); // 24px from scale
}
// Avoid: Arbitrary values break consistency
.section {
margin-bottom: 35px; // Don't do this
padding: 22px; // Don't do this
}Use semantic color names:
// Good: Semantic naming makes intent clear
.error-message {
color: colors.$color--error;
background: colors.$color--error-light;
}
.primary-button {
background: colors.$color--primary;
color: colors.$color--base;
}
// Avoid: Direct hex values lose semantic meaning
.error-message {
color: #ff4232; // What does this color represent?
}Stick to the type scale:
// Good: Use predefined sizes
h1 {
font-size: type.$font-size--h1; // 36px
}
.small-text {
font-size: type.$font-size--small; // 12px
}
// Avoid: Random font sizes
h1 {
font-size: 37px; // Why not 36px from the scale?
}Combine utility classes effectively:
// Good: Compose utilities for rapid development
<div className={`
${styles['margin-bottom--4']}
${styles['padding-top--3']}
${styles['font-size--h2']}
`}>
Content
</div>
// Also good: Use SCSS variables for complex components
.complex-component {
margin-bottom: utils.space(4);
padding-top: utils.space(3);
font-size: type.$font-size--h2;
color: colors.$color--primary;
}// Import SCSS module
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function Card({ children }) {
return (
<div className={styles['padding-top--4']}>
<h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
Card Title
</h2>
<div className={styles['margin-top--3']}>
{children}
</div>
</div>
);
}<template>
<div :class="$style['padding-top--4']">
<h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
Card Title
</h2>
</div>
</template>
<style module>
@use '@san-siva/stylekit/styles/index.module.scss' as *;
</style>// component.scss
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
:host {
display: block;
padding: utils.space(4);
}
.card {
background: colors.$color--base;
border: 1px solid colors.$color--border;
}While StyleKit provides sensible defaults, you can customize it for your needs:
// your-colors.scss
@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
// Add your custom colors
$color--brand: #your-color;
$color--custom: #another-color;
// Use both StyleKit and custom colors
.my-component {
background: stylekit-colors.$color--primary;
border-color: $color--brand;
}@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
// Define custom spacing
$spacing-custom: utils.rem(72);
.special-section {
margin-bottom: $spacing-custom;
// Or use the built-in space function
padding: utils.space(5); // 40px
}@use '@san-siva/stylekit/styles/typography.module.scss' as type;
// Override with your font
$custom-font-family: 'Your Font', sans-serif;
.heading {
font-family: $custom-font-family;
// But still use StyleKit's scale
font-size: type.$font-size--h1;
font-weight: type.$font-weight--700;
}Import only what you need: StyleKit's modular architecture allows you to import specific modules rather than the entire library, reducing your bundle size.
// Smaller bundle: Import specific modules
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
// vs.
// Larger bundle: Import everything
@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;Utility classes vs. SCSS variables:
If you're migrating from a custom design system or another framework:
Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeThis project is licensed under the MIT License.
Author: Santhosh Siva
GitHub: https://github.com/san-siva
StyleKit is a comprehensive, modular SCSS design system that provides a consistent foundation for building modern web applications. It includes a complete set of design tokens, utility classes, typography scales, color palettes, spacing systems, and animations. Built with CSS Modules support, StyleKit ensures style encapsulation while maintaining flexibility for customization.
Unlike Tailwind or Bootstrap, StyleKit focuses on developer-centric architecture rather than being a rigid framework or library. I would encourage you to use StyleKit as a starting point for your own design system, and then customize it to fit your needs.
Install StyleKit from npm:
1npm install @san-siva/stylekitOr using yarn:
1yarn add @san-siva/stylekit1npm install @san-siva/stylekit1yarn add @san-siva/stylekitStyleKit is organized into specialized modules, each handling a specific aspect of your design system:
colors.module.scsstypography.module.scssutils.module.scssdimensions.module.scssanimations.module.scssglobals.scssImport the main module to access all design tokens and utilities:
1@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
2
3.my-component {
4 color: stylekit.$color--primary;
5 padding: stylekit.space(2);
6 font-size: stylekit.$font-size--h3;
7}For better performance and explicit dependencies, import only what you need:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
background-color: colors.$color--base;
border: 1px solid colors.$color--border;
padding: utils.space(3);
border-radius: utils.rem(8);
}Import utility classes in your component or globally:
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function MyComponent() {
return (
<div className={styles['margin-bottom--3']}>
<h1 className={styles['font-size--h1']}>Title</h1>
<p className={styles['margin-top--2']}>Content</p>
</div>
);
}Import the main module to access all design tokens and utilities:
1@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
2
3.my-component {
4 color: stylekit.$color--primary;
5 padding: stylekit.space(2);
6 font-size: stylekit.$font-size--h3;
7}1@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
2
3.my-component {
4 color: stylekit.$color--primary;
5 padding: stylekit.space(2);
6 font-size: stylekit.$font-size--h3;
7}For better performance and explicit dependencies, import only what you need:
1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
3
4.card {
5 background-color: colors.$color--base;
6 border: 1px solid colors.$color--border;
7 padding: utils.space(3);
8 border-radius: utils.rem(8);
9}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
3
4.card {
5 background-color: colors.$color--base;
6 border: 1px solid colors.$color--border;
7 padding: utils.space(3);
8 border-radius: utils.rem(8);
9}Import utility classes in your component or globally:
1import styles from '@san-siva/stylekit/styles/index.module.scss';
2
3export function MyComponent() {
4 return (
5 <div className={styles['margin-bottom--3']}>
6 <h1 className={styles['font-size--h1']}>Title</h1>
7 <p className={styles['margin-top--2']}>Content</p>
8 </div>
9 );
10}1import styles from '@san-siva/stylekit/styles/index.module.scss';
2
3export function MyComponent() {
4 return (
5 <div className={styles['margin-bottom--3']}>
6 <h1 className={styles['font-size--h1']}>Title</h1>
7 <p className={styles['margin-top--2']}>Content</p>
8 </div>
9 );
10}Provides a comprehensive color palette with semantic naming and variants.
$color--primary, $color--primary-light, $color--primary-lighter$color--primary-accent, $color--primary-accent-light, $color--primary-accent-lighter$color--secondary, $color--secondary-light, $color--secondary-lighter$color--base, $color--surface, $color--code$color--grey-light, $color--grey-medium, $color--grey-dark, $color--grey-darker$color--error, $color--error-light, $color--link$color--primary#4242fa$color--primary-lightrgba(66, 66, 250, 0.05)$color--primary-lighterrgba(66, 66, 250, 0.02)$color--primary-accent#fed600$color--primary-accent-light#fef1c4$color--primary-accent-lighter#fef8e0$color--secondary#3dad84$color--secondary-light#ecf7f3$color--secondary-lighter#f2f9f7$color--base#ffffff$color--surface#f6f6f6$color--code#e8f1fc$color--grey-light#e1e5e9$color--grey-medium#c6c6c7$color--grey-dark#6b7c93$color--grey-darker#4f5969$color--error#ff4232$color--error-light#ffecea$color--link#0d6efd$color--dark#313030$color--black#000Example usage:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
.button--primary {
background-color: colors.$color--primary;
color: colors.$color--base;
&:hover {
background-color: colors.$color--primary-light;
}
}
.alert--error {
background-color: colors.$color--error-light;
border-left: 3px solid colors.$color--error;
color: colors.$color--dark;
}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2
3.button--primary {
4 background-color: colors.$color--primary;
5 color: colors.$color--base;
6
7 &:hover {
8 background-color: colors.$color--primary-light;
9 }
10}
11
12.alert--error {
13 background-color: colors.$color--error-light;
14 border-left: 3px solid colors.$color--error;
15 color: colors.$color--dark;
16}Defines a consistent typographic scale with font families, sizes, weights, and line heights.
Font Families:
$font-family--primary$font-family--secondary$font-family--codeFont Sizes:
$font-size--very-large.font-size--very-large$font-size--large.font-size--large$font-size--h1.font-size--h1$font-size--h2.font-size--h2$font-size--h3.font-size--h3$font-size--h4.font-size--h4$font-size--h5.font-size--h5$font-size--h6.font-size--h6$font-size--p.font-size--p$font-size--small.font-size--smallFont Weights:
$font-weight--400.font-weight--400$font-weight--500.font-weight--500$font-weight--600.font-weight--600$font-weight--700.font-weight--700$font-weight--800.font-weight--800Line Heights:
$line-height--large$line-height--normal$line-height--small$line-height--very-smallExample usage:
@use '@san-siva/stylekit/styles/typography.module.scss' as type;
.heading {
font-family: type.$font-family--secondary;
font-size: type.$font-size--h2;
font-weight: type.$font-weight--700;
line-height: type.$line-height--small;
}
.body-text {
font-family: type.$font-family--primary;
font-size: type.$font-size--p;
line-height: type.$line-height--normal;
}Using utility classes in React/JSX:
import styles from '@san-siva/stylekit/styles/typography.module.scss';
<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
Welcome
</h1>1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3.heading {
4 font-family: type.$font-family--secondary;
5 font-size: type.$font-size--h2;
6 font-weight: type.$font-weight--700;
7 line-height: type.$line-height--small;
8}
9
10.body-text {
11 font-family: type.$font-family--primary;
12 font-size: type.$font-size--p;
13 line-height: type.$line-height--normal;
14}1import styles from '@san-siva/stylekit/styles/typography.module.scss';
2
3<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
4 Welcome
5</h1>Provides utility functions and a comprehensive spacing system.
Utility Functions:
rem($px)em($px)space($n, $useEm)Spacing Scale:
Spacing Utility Classes:
Auto-generated margin and padding utilities for all sides (top, bottom, left, right):
1.margin-top--0 through .margin-top--9
2.margin-bottom--0 through .margin-bottom--9
3.margin-left--0 through .margin-left--9
4.margin-right--0 through .margin-right--9
5
6.padding-top--0 through .padding-top--9
7.padding-bottom--0 through .padding-bottom--9
8.padding-left--0 through .padding-left--9
9.padding-right--0 through .padding-right--9All spacing utility classes are also available with !important modifiers to override other styles when needed.
Example usage with functions:
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
padding: utils.space(3); // 24px (1.5rem)
margin-bottom: utils.space(4); // 32px (2rem)
border-radius: utils.rem(8); // 0.5rem
.card-header {
margin-bottom: utils.space(2); // 16px (1rem)
font-size: utils.rem(20); // 1.25rem
}
}Example usage with utility classes:
import styles from '@san-siva/stylekit/styles/utils.module.scss';
<div className={styles['padding-top--4']}>
<h2 className={styles['margin-bottom--2']}>Section Title</h2>
<p className={styles['margin-bottom--3']}>Content here</p>
</div>1.margin-top--0 through .margin-top--9
2.margin-bottom--0 through .margin-bottom--9
3.margin-left--0 through .margin-left--9
4.margin-right--0 through .margin-right--9
5
6.padding-top--0 through .padding-top--9
7.padding-bottom--0 through .padding-bottom--9
8.padding-left--0 through .padding-left--9
9.padding-right--0 through .padding-right--91@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3.card {
4 padding: utils.space(3); // 24px (1.5rem)
5 margin-bottom: utils.space(4); // 32px (2rem)
6 border-radius: utils.rem(8); // 0.5rem
7
8 .card-header {
9 margin-bottom: utils.space(2); // 16px (1rem)
10 font-size: utils.rem(20); // 1.25rem
11 }
12}1import styles from '@san-siva/stylekit/styles/utils.module.scss';
2
3<div className={styles['padding-top--4']}>
4 <h2 className={styles['margin-bottom--2']}>Section Title</h2>
5 <p className={styles['margin-bottom--3']}>Content here</p>
6</div>Provides pre-built keyframe animations for common UI patterns.
loading_animationMoveInTopfadeInDownfadeUpExample usage:
1@use '@san-siva/stylekit/styles/animations.module.scss';
2
3.modal-enter {
4 animation: MoveInTop 0.3s ease-out;
5}
6
7.notification {
8 animation: fadeInDown 0.4s ease-out;
9}
10
11.loading-bar {
12 animation: loading_animation 4s linear infinite;
13 background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
14 background-size: 200% 100%;
15}1@use '@san-siva/stylekit/styles/animations.module.scss';
2
3.modal-enter {
4 animation: MoveInTop 0.3s ease-out;
5}
6
7.notification {
8 animation: fadeInDown 0.4s ease-out;
9}
10
11.loading-bar {
12 animation: loading_animation 4s linear infinite;
13 background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
14 background-size: 200% 100%;
15}Defines layout containers, page structures, border radius values, and responsive breakpoints.
Container System:
.container {
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 18px;
min-height: calc(100% - 36px);
width: calc(100% - 36px);
}
.container--contents-centered {
justify-content: center;
align-items: center;
}
.container--no-padding {
padding: 0;
}Page Layout:
.page {
--topbar-height: 80px;
max-width: 1216px;
margin: 0 auto;
padding: 48px calculated-sides;
// Responsive padding and width management
// Automatically adjusts for mobile, tablet, and desktop
}
.page--contents-max-width {
> * {
max-width: 780px;
}
}
.page--no-extra-padding {
--width-sections: calc(100% - 32px);
--padding-sections-left: 32px;
}Border Radius Scale:
$border-radius$border-radius--1$border-radius--1-5$border-radius--2$border-radius--3$border-radius--4Responsive Breakpoints:
The dimensions module automatically applies responsive padding adjustments at each breakpoint. The .page class uses CSS custom properties to maintain consistent spacing across different screen sizes.
@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
.card {
border-radius: dims.$border-radius--2;
max-width: dims.$max-width--page-contents;
}
.rounded-button {
border-radius: dims.$border-radius--1;
}
// Use built-in container
.my-container {
@extend .container;
@extend .container--contents-centered;
}1.container {
2 display: flex;
3 flex-direction: column;
4 justify-content: flex-start;
5 padding: 18px;
6 min-height: calc(100% - 36px);
7 width: calc(100% - 36px);
8}
9
10.container--contents-centered {
11 justify-content: center;
12 align-items: center;
13}
14
15.container--no-padding {
16 padding: 0;
17}1.page {
2 --topbar-height: 80px;
3 max-width: 1216px;
4 margin: 0 auto;
5 padding: 48px calculated-sides;
6
7 // Responsive padding and width management
8 // Automatically adjusts for mobile, tablet, and desktop
9}
10
11.page--contents-max-width {
12 > * {
13 max-width: 780px;
14 }
15}
16
17.page--no-extra-padding {
18 --width-sections: calc(100% - 32px);
19 --padding-sections-left: 32px;
20}1@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
2
3.card {
4 border-radius: dims.$border-radius--2;
5 max-width: dims.$max-width--page-contents;
6}
7
8.rounded-button {
9 border-radius: dims.$border-radius--1;
10}
11
12// Use built-in container
13.my-container {
14 @extend .container;
15 @extend .container--contents-centered;
16}Follow these guidelines to get the most out of StyleKit:
Use namespaces to avoid conflicts:
1// Good: Use namespaces with @use
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5.component {
6 color: colors.$color--primary;
7 padding: utils.space(2);
8}
9
10// Avoid: @import mixes everything into global scope
11@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do thisAlways use the spacing scale:
// Good: Use spacing scale
.section {
margin-bottom: utils.space(4); // 32px from scale
padding: utils.space(3); // 24px from scale
}
// Avoid: Arbitrary values break consistency
.section {
margin-bottom: 35px; // Don't do this
padding: 22px; // Don't do this
}Use semantic color names:
// Good: Semantic naming makes intent clear
.error-message {
color: colors.$color--error;
background: colors.$color--error-light;
}
.primary-button {
background: colors.$color--primary;
color: colors.$color--base;
}
// Avoid: Direct hex values lose semantic meaning
.error-message {
color: #ff4232; // What does this color represent?
}Stick to the type scale:
// Good: Use predefined sizes
h1 {
font-size: type.$font-size--h1; // 36px
}
.small-text {
font-size: type.$font-size--small; // 12px
}
// Avoid: Random font sizes
h1 {
font-size: 37px; // Why not 36px from the scale?
}Combine utility classes effectively:
// Good: Compose utilities for rapid development
<div className={`
${styles['margin-bottom--4']}
${styles['padding-top--3']}
${styles['font-size--h2']}
`}>
Content
</div>
// Also good: Use SCSS variables for complex components
.complex-component {
margin-bottom: utils.space(4);
padding-top: utils.space(3);
font-size: type.$font-size--h2;
color: colors.$color--primary;
}Use namespaces to avoid conflicts:
1// Good: Use namespaces with @use
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5.component {
6 color: colors.$color--primary;
7 padding: utils.space(2);
8}
9
10// Avoid: @import mixes everything into global scope
11@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do this1// Good: Use namespaces with @use
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5.component {
6 color: colors.$color--primary;
7 padding: utils.space(2);
8}
9
10// Avoid: @import mixes everything into global scope
11@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do thisAlways use the spacing scale:
1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}Use semantic color names:
1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}Stick to the type scale:
1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}Combine utility classes effectively:
1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}// Import SCSS module
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function Card({ children }) {
return (
<div className={styles['padding-top--4']}>
<h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
Card Title
</h2>
<div className={styles['margin-top--3']}>
{children}
</div>
</div>
);
}1<template>
2 <div :class="$style['padding-top--4']">
3 <h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
4 Card Title
5 </h2>
6 </div>
7</template>
8
9<style module>
10@use '@san-siva/stylekit/styles/index.module.scss' as *;
11</style>// component.scss
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
:host {
display: block;
padding: utils.space(4);
}
.card {
background: colors.$color--base;
border: 1px solid colors.$color--border;
}1// Import SCSS module
2import styles from '@san-siva/stylekit/styles/index.module.scss';
3
4export function Card({ children }) {
5 return (
6 <div className={styles['padding-top--4']}>
7 <h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
8 Card Title
9 </h2>
10 <div className={styles['margin-top--3']}>
11 {children}
12 </div>
13 </div>
14 );
15}1// Import SCSS module
2import styles from '@san-siva/stylekit/styles/index.module.scss';
3
4export function Card({ children }) {
5 return (
6 <div className={styles['padding-top--4']}>
7 <h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
8 Card Title
9 </h2>
10 <div className={styles['margin-top--3']}>
11 {children}
12 </div>
13 </div>
14 );
15}1<template>
2 <div :class="$style['padding-top--4']">
3 <h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
4 Card Title
5 </h2>
6 </div>
7</template>
8
9<style module>
10@use '@san-siva/stylekit/styles/index.module.scss' as *;
11</style>1<template>
2 <div :class="$style['padding-top--4']">
3 <h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
4 Card Title
5 </h2>
6 </div>
7</template>
8
9<style module>
10@use '@san-siva/stylekit/styles/index.module.scss' as *;
11</style>1// component.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5:host {
6 display: block;
7 padding: utils.space(4);
8}
9
10.card {
11 background: colors.$color--base;
12 border: 1px solid colors.$color--border;
13}1// component.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5:host {
6 display: block;
7 padding: utils.space(4);
8}
9
10.card {
11 background: colors.$color--base;
12 border: 1px solid colors.$color--border;
13}While StyleKit provides sensible defaults, you can customize it for your needs:
1// your-colors.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
3
4// Add your custom colors
5$color--brand: #your-color;
6$color--custom: #another-color;
7
8// Use both StyleKit and custom colors
9.my-component {
10 background: stylekit-colors.$color--primary;
11 border-color: $color--brand;
12}@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
// Define custom spacing
$spacing-custom: utils.rem(72);
.special-section {
margin-bottom: $spacing-custom;
// Or use the built-in space function
padding: utils.space(5); // 40px
}@use '@san-siva/stylekit/styles/typography.module.scss' as type;
// Override with your font
$custom-font-family: 'Your Font', sans-serif;
.heading {
font-family: $custom-font-family;
// But still use StyleKit's scale
font-size: type.$font-size--h1;
font-weight: type.$font-weight--700;
}1// your-colors.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
3
4// Add your custom colors
5$color--brand: #your-color;
6$color--custom: #another-color;
7
8// Use both StyleKit and custom colors
9.my-component {
10 background: stylekit-colors.$color--primary;
11 border-color: $color--brand;
12}1// your-colors.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
3
4// Add your custom colors
5$color--brand: #your-color;
6$color--custom: #another-color;
7
8// Use both StyleKit and custom colors
9.my-component {
10 background: stylekit-colors.$color--primary;
11 border-color: $color--brand;
12}1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3// Define custom spacing
4$spacing-custom: utils.rem(72);
5
6.special-section {
7 margin-bottom: $spacing-custom;
8 // Or use the built-in space function
9 padding: utils.space(5); // 40px
10}1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3// Define custom spacing
4$spacing-custom: utils.rem(72);
5
6.special-section {
7 margin-bottom: $spacing-custom;
8 // Or use the built-in space function
9 padding: utils.space(5); // 40px
10}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3// Override with your font
4$custom-font-family: 'Your Font', sans-serif;
5
6.heading {
7 font-family: $custom-font-family;
8 // But still use StyleKit's scale
9 font-size: type.$font-size--h1;
10 font-weight: type.$font-weight--700;
11}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3// Override with your font
4$custom-font-family: 'Your Font', sans-serif;
5
6.heading {
7 font-family: $custom-font-family;
8 // But still use StyleKit's scale
9 font-size: type.$font-size--h1;
10 font-weight: type.$font-weight--700;
11}Import only what you need: StyleKit's modular architecture allows you to import specific modules rather than the entire library, reducing your bundle size.
1// Smaller bundle: Import specific modules
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5// vs.
6
7// Larger bundle: Import everything
8@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;Utility classes vs. SCSS variables:
1// Smaller bundle: Import specific modules
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5// vs.
6
7// Larger bundle: Import everything
8@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;If you're migrating from a custom design system or another framework:
Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contributeStyleKit is a comprehensive, modular SCSS design system that provides a consistent foundation for building modern web applications. It includes a complete set of design tokens, utility classes, typography scales, color palettes, spacing systems, and animations. Built with CSS Modules support, StyleKit ensures style encapsulation while maintaining flexibility for customization.
Unlike Tailwind or Bootstrap, StyleKit focuses on developer-centric architecture rather than being a rigid framework or library. I would encourage you to use StyleKit as a starting point for your own design system, and then customize it to fit your needs.
Install StyleKit from npm:
1npm install @san-siva/stylekitOr using yarn:
1yarn add @san-siva/stylekit1npm install @san-siva/stylekit1yarn add @san-siva/stylekitStyleKit is organized into specialized modules, each handling a specific aspect of your design system:
colors.module.scsstypography.module.scssutils.module.scssdimensions.module.scssanimations.module.scssglobals.scssImport the main module to access all design tokens and utilities:
1@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
2
3.my-component {
4 color: stylekit.$color--primary;
5 padding: stylekit.space(2);
6 font-size: stylekit.$font-size--h3;
7}For better performance and explicit dependencies, import only what you need:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
background-color: colors.$color--base;
border: 1px solid colors.$color--border;
padding: utils.space(3);
border-radius: utils.rem(8);
}Import utility classes in your component or globally:
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function MyComponent() {
return (
<div className={styles['margin-bottom--3']}>
<h1 className={styles['font-size--h1']}>Title</h1>
<p className={styles['margin-top--2']}>Content</p>
</div>
);
}Import the main module to access all design tokens and utilities:
1@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
2
3.my-component {
4 color: stylekit.$color--primary;
5 padding: stylekit.space(2);
6 font-size: stylekit.$font-size--h3;
7}1@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;
2
3.my-component {
4 color: stylekit.$color--primary;
5 padding: stylekit.space(2);
6 font-size: stylekit.$font-size--h3;
7}For better performance and explicit dependencies, import only what you need:
1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
3
4.card {
5 background-color: colors.$color--base;
6 border: 1px solid colors.$color--border;
7 padding: utils.space(3);
8 border-radius: utils.rem(8);
9}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
3
4.card {
5 background-color: colors.$color--base;
6 border: 1px solid colors.$color--border;
7 padding: utils.space(3);
8 border-radius: utils.rem(8);
9}Import utility classes in your component or globally:
1import styles from '@san-siva/stylekit/styles/index.module.scss';
2
3export function MyComponent() {
4 return (
5 <div className={styles['margin-bottom--3']}>
6 <h1 className={styles['font-size--h1']}>Title</h1>
7 <p className={styles['margin-top--2']}>Content</p>
8 </div>
9 );
10}1import styles from '@san-siva/stylekit/styles/index.module.scss';
2
3export function MyComponent() {
4 return (
5 <div className={styles['margin-bottom--3']}>
6 <h1 className={styles['font-size--h1']}>Title</h1>
7 <p className={styles['margin-top--2']}>Content</p>
8 </div>
9 );
10}Provides a comprehensive color palette with semantic naming and variants.
$color--primary, $color--primary-light, $color--primary-lighter$color--primary-accent, $color--primary-accent-light, $color--primary-accent-lighter$color--secondary, $color--secondary-light, $color--secondary-lighter$color--base, $color--surface, $color--code$color--grey-light, $color--grey-medium, $color--grey-dark, $color--grey-darker$color--error, $color--error-light, $color--link$color--primary#4242fa$color--primary-lightrgba(66, 66, 250, 0.05)$color--primary-lighterrgba(66, 66, 250, 0.02)$color--primary-accent#fed600$color--primary-accent-light#fef1c4$color--primary-accent-lighter#fef8e0$color--secondary#3dad84$color--secondary-light#ecf7f3$color--secondary-lighter#f2f9f7$color--base#ffffff$color--surface#f6f6f6$color--code#e8f1fc$color--grey-light#e1e5e9$color--grey-medium#c6c6c7$color--grey-dark#6b7c93$color--grey-darker#4f5969$color--error#ff4232$color--error-light#ffecea$color--link#0d6efd$color--dark#313030$color--black#000Example usage:
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
.button--primary {
background-color: colors.$color--primary;
color: colors.$color--base;
&:hover {
background-color: colors.$color--primary-light;
}
}
.alert--error {
background-color: colors.$color--error-light;
border-left: 3px solid colors.$color--error;
color: colors.$color--dark;
}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2
3.button--primary {
4 background-color: colors.$color--primary;
5 color: colors.$color--base;
6
7 &:hover {
8 background-color: colors.$color--primary-light;
9 }
10}
11
12.alert--error {
13 background-color: colors.$color--error-light;
14 border-left: 3px solid colors.$color--error;
15 color: colors.$color--dark;
16}Defines a consistent typographic scale with font families, sizes, weights, and line heights.
Font Families:
$font-family--primary$font-family--secondary$font-family--codeFont Sizes:
$font-size--very-large.font-size--very-large$font-size--large.font-size--large$font-size--h1.font-size--h1$font-size--h2.font-size--h2$font-size--h3.font-size--h3$font-size--h4.font-size--h4$font-size--h5.font-size--h5$font-size--h6.font-size--h6$font-size--p.font-size--p$font-size--small.font-size--smallFont Weights:
$font-weight--400.font-weight--400$font-weight--500.font-weight--500$font-weight--600.font-weight--600$font-weight--700.font-weight--700$font-weight--800.font-weight--800Line Heights:
$line-height--large$line-height--normal$line-height--small$line-height--very-smallExample usage:
@use '@san-siva/stylekit/styles/typography.module.scss' as type;
.heading {
font-family: type.$font-family--secondary;
font-size: type.$font-size--h2;
font-weight: type.$font-weight--700;
line-height: type.$line-height--small;
}
.body-text {
font-family: type.$font-family--primary;
font-size: type.$font-size--p;
line-height: type.$line-height--normal;
}Using utility classes in React/JSX:
import styles from '@san-siva/stylekit/styles/typography.module.scss';
<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
Welcome
</h1>1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3.heading {
4 font-family: type.$font-family--secondary;
5 font-size: type.$font-size--h2;
6 font-weight: type.$font-weight--700;
7 line-height: type.$line-height--small;
8}
9
10.body-text {
11 font-family: type.$font-family--primary;
12 font-size: type.$font-size--p;
13 line-height: type.$line-height--normal;
14}1import styles from '@san-siva/stylekit/styles/typography.module.scss';
2
3<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
4 Welcome
5</h1>Provides utility functions and a comprehensive spacing system.
Utility Functions:
rem($px)em($px)space($n, $useEm)Spacing Scale:
Spacing Utility Classes:
Auto-generated margin and padding utilities for all sides (top, bottom, left, right):
1.margin-top--0 through .margin-top--9
2.margin-bottom--0 through .margin-bottom--9
3.margin-left--0 through .margin-left--9
4.margin-right--0 through .margin-right--9
5
6.padding-top--0 through .padding-top--9
7.padding-bottom--0 through .padding-bottom--9
8.padding-left--0 through .padding-left--9
9.padding-right--0 through .padding-right--9All spacing utility classes are also available with !important modifiers to override other styles when needed.
Example usage with functions:
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
.card {
padding: utils.space(3); // 24px (1.5rem)
margin-bottom: utils.space(4); // 32px (2rem)
border-radius: utils.rem(8); // 0.5rem
.card-header {
margin-bottom: utils.space(2); // 16px (1rem)
font-size: utils.rem(20); // 1.25rem
}
}Example usage with utility classes:
import styles from '@san-siva/stylekit/styles/utils.module.scss';
<div className={styles['padding-top--4']}>
<h2 className={styles['margin-bottom--2']}>Section Title</h2>
<p className={styles['margin-bottom--3']}>Content here</p>
</div>1.margin-top--0 through .margin-top--9
2.margin-bottom--0 through .margin-bottom--9
3.margin-left--0 through .margin-left--9
4.margin-right--0 through .margin-right--9
5
6.padding-top--0 through .padding-top--9
7.padding-bottom--0 through .padding-bottom--9
8.padding-left--0 through .padding-left--9
9.padding-right--0 through .padding-right--91@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3.card {
4 padding: utils.space(3); // 24px (1.5rem)
5 margin-bottom: utils.space(4); // 32px (2rem)
6 border-radius: utils.rem(8); // 0.5rem
7
8 .card-header {
9 margin-bottom: utils.space(2); // 16px (1rem)
10 font-size: utils.rem(20); // 1.25rem
11 }
12}1import styles from '@san-siva/stylekit/styles/utils.module.scss';
2
3<div className={styles['padding-top--4']}>
4 <h2 className={styles['margin-bottom--2']}>Section Title</h2>
5 <p className={styles['margin-bottom--3']}>Content here</p>
6</div>Provides pre-built keyframe animations for common UI patterns.
loading_animationMoveInTopfadeInDownfadeUpExample usage:
1@use '@san-siva/stylekit/styles/animations.module.scss';
2
3.modal-enter {
4 animation: MoveInTop 0.3s ease-out;
5}
6
7.notification {
8 animation: fadeInDown 0.4s ease-out;
9}
10
11.loading-bar {
12 animation: loading_animation 4s linear infinite;
13 background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
14 background-size: 200% 100%;
15}1@use '@san-siva/stylekit/styles/animations.module.scss';
2
3.modal-enter {
4 animation: MoveInTop 0.3s ease-out;
5}
6
7.notification {
8 animation: fadeInDown 0.4s ease-out;
9}
10
11.loading-bar {
12 animation: loading_animation 4s linear infinite;
13 background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
14 background-size: 200% 100%;
15}Defines layout containers, page structures, border radius values, and responsive breakpoints.
Container System:
.container {
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 18px;
min-height: calc(100% - 36px);
width: calc(100% - 36px);
}
.container--contents-centered {
justify-content: center;
align-items: center;
}
.container--no-padding {
padding: 0;
}Page Layout:
.page {
--topbar-height: 80px;
max-width: 1216px;
margin: 0 auto;
padding: 48px calculated-sides;
// Responsive padding and width management
// Automatically adjusts for mobile, tablet, and desktop
}
.page--contents-max-width {
> * {
max-width: 780px;
}
}
.page--no-extra-padding {
--width-sections: calc(100% - 32px);
--padding-sections-left: 32px;
}Border Radius Scale:
$border-radius$border-radius--1$border-radius--1-5$border-radius--2$border-radius--3$border-radius--4Responsive Breakpoints:
The dimensions module automatically applies responsive padding adjustments at each breakpoint. The .page class uses CSS custom properties to maintain consistent spacing across different screen sizes.
@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
.card {
border-radius: dims.$border-radius--2;
max-width: dims.$max-width--page-contents;
}
.rounded-button {
border-radius: dims.$border-radius--1;
}
// Use built-in container
.my-container {
@extend .container;
@extend .container--contents-centered;
}1.container {
2 display: flex;
3 flex-direction: column;
4 justify-content: flex-start;
5 padding: 18px;
6 min-height: calc(100% - 36px);
7 width: calc(100% - 36px);
8}
9
10.container--contents-centered {
11 justify-content: center;
12 align-items: center;
13}
14
15.container--no-padding {
16 padding: 0;
17}1.page {
2 --topbar-height: 80px;
3 max-width: 1216px;
4 margin: 0 auto;
5 padding: 48px calculated-sides;
6
7 // Responsive padding and width management
8 // Automatically adjusts for mobile, tablet, and desktop
9}
10
11.page--contents-max-width {
12 > * {
13 max-width: 780px;
14 }
15}
16
17.page--no-extra-padding {
18 --width-sections: calc(100% - 32px);
19 --padding-sections-left: 32px;
20}1@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
2
3.card {
4 border-radius: dims.$border-radius--2;
5 max-width: dims.$max-width--page-contents;
6}
7
8.rounded-button {
9 border-radius: dims.$border-radius--1;
10}
11
12// Use built-in container
13.my-container {
14 @extend .container;
15 @extend .container--contents-centered;
16}Follow these guidelines to get the most out of StyleKit:
Use namespaces to avoid conflicts:
1// Good: Use namespaces with @use
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5.component {
6 color: colors.$color--primary;
7 padding: utils.space(2);
8}
9
10// Avoid: @import mixes everything into global scope
11@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do thisAlways use the spacing scale:
// Good: Use spacing scale
.section {
margin-bottom: utils.space(4); // 32px from scale
padding: utils.space(3); // 24px from scale
}
// Avoid: Arbitrary values break consistency
.section {
margin-bottom: 35px; // Don't do this
padding: 22px; // Don't do this
}Use semantic color names:
// Good: Semantic naming makes intent clear
.error-message {
color: colors.$color--error;
background: colors.$color--error-light;
}
.primary-button {
background: colors.$color--primary;
color: colors.$color--base;
}
// Avoid: Direct hex values lose semantic meaning
.error-message {
color: #ff4232; // What does this color represent?
}Stick to the type scale:
// Good: Use predefined sizes
h1 {
font-size: type.$font-size--h1; // 36px
}
.small-text {
font-size: type.$font-size--small; // 12px
}
// Avoid: Random font sizes
h1 {
font-size: 37px; // Why not 36px from the scale?
}Combine utility classes effectively:
// Good: Compose utilities for rapid development
<div className={`
${styles['margin-bottom--4']}
${styles['padding-top--3']}
${styles['font-size--h2']}
`}>
Content
</div>
// Also good: Use SCSS variables for complex components
.complex-component {
margin-bottom: utils.space(4);
padding-top: utils.space(3);
font-size: type.$font-size--h2;
color: colors.$color--primary;
}Use namespaces to avoid conflicts:
1// Good: Use namespaces with @use
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5.component {
6 color: colors.$color--primary;
7 padding: utils.space(2);
8}
9
10// Avoid: @import mixes everything into global scope
11@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do this1// Good: Use namespaces with @use
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5.component {
6 color: colors.$color--primary;
7 padding: utils.space(2);
8}
9
10// Avoid: @import mixes everything into global scope
11@import '@san-siva/stylekit/styles/colors.module.scss'; // Don't do thisAlways use the spacing scale:
1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}Use semantic color names:
1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}Stick to the type scale:
1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}Combine utility classes effectively:
1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}// Import SCSS module
import styles from '@san-siva/stylekit/styles/index.module.scss';
export function Card({ children }) {
return (
<div className={styles['padding-top--4']}>
<h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
Card Title
</h2>
<div className={styles['margin-top--3']}>
{children}
</div>
</div>
);
}1<template>
2 <div :class="$style['padding-top--4']">
3 <h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
4 Card Title
5 </h2>
6 </div>
7</template>
8
9<style module>
10@use '@san-siva/stylekit/styles/index.module.scss' as *;
11</style>// component.scss
@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
:host {
display: block;
padding: utils.space(4);
}
.card {
background: colors.$color--base;
border: 1px solid colors.$color--border;
}1// Import SCSS module
2import styles from '@san-siva/stylekit/styles/index.module.scss';
3
4export function Card({ children }) {
5 return (
6 <div className={styles['padding-top--4']}>
7 <h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
8 Card Title
9 </h2>
10 <div className={styles['margin-top--3']}>
11 {children}
12 </div>
13 </div>
14 );
15}1// Import SCSS module
2import styles from '@san-siva/stylekit/styles/index.module.scss';
3
4export function Card({ children }) {
5 return (
6 <div className={styles['padding-top--4']}>
7 <h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
8 Card Title
9 </h2>
10 <div className={styles['margin-top--3']}>
11 {children}
12 </div>
13 </div>
14 );
15}1<template>
2 <div :class="$style['padding-top--4']">
3 <h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
4 Card Title
5 </h2>
6 </div>
7</template>
8
9<style module>
10@use '@san-siva/stylekit/styles/index.module.scss' as *;
11</style>1<template>
2 <div :class="$style['padding-top--4']">
3 <h2 :class="[$style['font-size--h2'], $style['margin-bottom--2']]">
4 Card Title
5 </h2>
6 </div>
7</template>
8
9<style module>
10@use '@san-siva/stylekit/styles/index.module.scss' as *;
11</style>1// component.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5:host {
6 display: block;
7 padding: utils.space(4);
8}
9
10.card {
11 background: colors.$color--base;
12 border: 1px solid colors.$color--border;
13}1// component.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5:host {
6 display: block;
7 padding: utils.space(4);
8}
9
10.card {
11 background: colors.$color--base;
12 border: 1px solid colors.$color--border;
13}While StyleKit provides sensible defaults, you can customize it for your needs:
1// your-colors.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
3
4// Add your custom colors
5$color--brand: #your-color;
6$color--custom: #another-color;
7
8// Use both StyleKit and custom colors
9.my-component {
10 background: stylekit-colors.$color--primary;
11 border-color: $color--brand;
12}@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
// Define custom spacing
$spacing-custom: utils.rem(72);
.special-section {
margin-bottom: $spacing-custom;
// Or use the built-in space function
padding: utils.space(5); // 40px
}@use '@san-siva/stylekit/styles/typography.module.scss' as type;
// Override with your font
$custom-font-family: 'Your Font', sans-serif;
.heading {
font-family: $custom-font-family;
// But still use StyleKit's scale
font-size: type.$font-size--h1;
font-weight: type.$font-weight--700;
}1// your-colors.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
3
4// Add your custom colors
5$color--brand: #your-color;
6$color--custom: #another-color;
7
8// Use both StyleKit and custom colors
9.my-component {
10 background: stylekit-colors.$color--primary;
11 border-color: $color--brand;
12}1// your-colors.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as stylekit-colors;
3
4// Add your custom colors
5$color--brand: #your-color;
6$color--custom: #another-color;
7
8// Use both StyleKit and custom colors
9.my-component {
10 background: stylekit-colors.$color--primary;
11 border-color: $color--brand;
12}1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3// Define custom spacing
4$spacing-custom: utils.rem(72);
5
6.special-section {
7 margin-bottom: $spacing-custom;
8 // Or use the built-in space function
9 padding: utils.space(5); // 40px
10}1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3// Define custom spacing
4$spacing-custom: utils.rem(72);
5
6.special-section {
7 margin-bottom: $spacing-custom;
8 // Or use the built-in space function
9 padding: utils.space(5); // 40px
10}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3// Override with your font
4$custom-font-family: 'Your Font', sans-serif;
5
6.heading {
7 font-family: $custom-font-family;
8 // But still use StyleKit's scale
9 font-size: type.$font-size--h1;
10 font-weight: type.$font-weight--700;
11}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3// Override with your font
4$custom-font-family: 'Your Font', sans-serif;
5
6.heading {
7 font-family: $custom-font-family;
8 // But still use StyleKit's scale
9 font-size: type.$font-size--h1;
10 font-weight: type.$font-weight--700;
11}Import only what you need: StyleKit's modular architecture allows you to import specific modules rather than the entire library, reducing your bundle size.
1// Smaller bundle: Import specific modules
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5// vs.
6
7// Larger bundle: Import everything
8@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;Utility classes vs. SCSS variables:
1// Smaller bundle: Import specific modules
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5// vs.
6
7// Larger bundle: Import everything
8@use '@san-siva/stylekit/styles/index.module.scss' as stylekit;If you're migrating from a custom design system or another framework:
Contributions are welcome! Please fork the repository and submit pull requests. For bugs or feature requests, open an issue on the repository.
View source code, report issues, and contribute1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
3
4.card {
5 background-color: colors.$color--base;
6 border: 1px solid colors.$color--border;
7 padding: utils.space(3);
8 border-radius: utils.rem(8);
9}1import styles from '@san-siva/stylekit/styles/index.module.scss';
2
3export function MyComponent() {
4 return (
5 <div className={styles['margin-bottom--3']}>
6 <h1 className={styles['font-size--h1']}>Title</h1>
7 <p className={styles['margin-top--2']}>Content</p>
8 </div>
9 );
10}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2
3.button--primary {
4 background-color: colors.$color--primary;
5 color: colors.$color--base;
6
7 &:hover {
8 background-color: colors.$color--primary-light;
9 }
10}
11
12.alert--error {
13 background-color: colors.$color--error-light;
14 border-left: 3px solid colors.$color--error;
15 color: colors.$color--dark;
16}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3.heading {
4 font-family: type.$font-family--secondary;
5 font-size: type.$font-size--h2;
6 font-weight: type.$font-weight--700;
7 line-height: type.$line-height--small;
8}
9
10.body-text {
11 font-family: type.$font-family--primary;
12 font-size: type.$font-size--p;
13 line-height: type.$line-height--normal;
14}1import styles from '@san-siva/stylekit/styles/typography.module.scss';
2
3<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
4 Welcome
5</h1>1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3.card {
4 padding: utils.space(3); // 24px (1.5rem)
5 margin-bottom: utils.space(4); // 32px (2rem)
6 border-radius: utils.rem(8); // 0.5rem
7
8 .card-header {
9 margin-bottom: utils.space(2); // 16px (1rem)
10 font-size: utils.rem(20); // 1.25rem
11 }
12}1import styles from '@san-siva/stylekit/styles/utils.module.scss';
2
3<div className={styles['padding-top--4']}>
4 <h2 className={styles['margin-bottom--2']}>Section Title</h2>
5 <p className={styles['margin-bottom--3']}>Content here</p>
6</div>1.container {
2 display: flex;
3 flex-direction: column;
4 justify-content: flex-start;
5 padding: 18px;
6 min-height: calc(100% - 36px);
7 width: calc(100% - 36px);
8}
9
10.container--contents-centered {
11 justify-content: center;
12 align-items: center;
13}
14
15.container--no-padding {
16 padding: 0;
17}1.page {
2 --topbar-height: 80px;
3 max-width: 1216px;
4 margin: 0 auto;
5 padding: 48px calculated-sides;
6
7 // Responsive padding and width management
8 // Automatically adjusts for mobile, tablet, and desktop
9}
10
11.page--contents-max-width {
12 > * {
13 max-width: 780px;
14 }
15}
16
17.page--no-extra-padding {
18 --width-sections: calc(100% - 32px);
19 --padding-sections-left: 32px;
20}1@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
2
3.card {
4 border-radius: dims.$border-radius--2;
5 max-width: dims.$max-width--page-contents;
6}
7
8.rounded-button {
9 border-radius: dims.$border-radius--1;
10}
11
12// Use built-in container
13.my-container {
14 @extend .container;
15 @extend .container--contents-centered;
16}Always use the spacing scale:
1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}Use semantic color names:
1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}Stick to the type scale:
1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}Combine utility classes effectively:
1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}1// Import SCSS module
2import styles from '@san-siva/stylekit/styles/index.module.scss';
3
4export function Card({ children }) {
5 return (
6 <div className={styles['padding-top--4']}>
7 <h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
8 Card Title
9 </h2>
10 <div className={styles['margin-top--3']}>
11 {children}
12 </div>
13 </div>
14 );
15}1// component.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5:host {
6 display: block;
7 padding: utils.space(4);
8}
9
10.card {
11 background: colors.$color--base;
12 border: 1px solid colors.$color--border;
13}1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3// Define custom spacing
4$spacing-custom: utils.rem(72);
5
6.special-section {
7 margin-bottom: $spacing-custom;
8 // Or use the built-in space function
9 padding: utils.space(5); // 40px
10}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3// Override with your font
4$custom-font-family: 'Your Font', sans-serif;
5
6.heading {
7 font-family: $custom-font-family;
8 // But still use StyleKit's scale
9 font-size: type.$font-size--h1;
10 font-weight: type.$font-weight--700;
11}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
3
4.card {
5 background-color: colors.$color--base;
6 border: 1px solid colors.$color--border;
7 padding: utils.space(3);
8 border-radius: utils.rem(8);
9}1import styles from '@san-siva/stylekit/styles/index.module.scss';
2
3export function MyComponent() {
4 return (
5 <div className={styles['margin-bottom--3']}>
6 <h1 className={styles['font-size--h1']}>Title</h1>
7 <p className={styles['margin-top--2']}>Content</p>
8 </div>
9 );
10}1@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
2
3.button--primary {
4 background-color: colors.$color--primary;
5 color: colors.$color--base;
6
7 &:hover {
8 background-color: colors.$color--primary-light;
9 }
10}
11
12.alert--error {
13 background-color: colors.$color--error-light;
14 border-left: 3px solid colors.$color--error;
15 color: colors.$color--dark;
16}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3.heading {
4 font-family: type.$font-family--secondary;
5 font-size: type.$font-size--h2;
6 font-weight: type.$font-weight--700;
7 line-height: type.$line-height--small;
8}
9
10.body-text {
11 font-family: type.$font-family--primary;
12 font-size: type.$font-size--p;
13 line-height: type.$line-height--normal;
14}1import styles from '@san-siva/stylekit/styles/typography.module.scss';
2
3<h1 className={`${styles['font-size--h1']} ${styles['font-weight--700']}`}>
4 Welcome
5</h1>1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3.card {
4 padding: utils.space(3); // 24px (1.5rem)
5 margin-bottom: utils.space(4); // 32px (2rem)
6 border-radius: utils.rem(8); // 0.5rem
7
8 .card-header {
9 margin-bottom: utils.space(2); // 16px (1rem)
10 font-size: utils.rem(20); // 1.25rem
11 }
12}1import styles from '@san-siva/stylekit/styles/utils.module.scss';
2
3<div className={styles['padding-top--4']}>
4 <h2 className={styles['margin-bottom--2']}>Section Title</h2>
5 <p className={styles['margin-bottom--3']}>Content here</p>
6</div>1.container {
2 display: flex;
3 flex-direction: column;
4 justify-content: flex-start;
5 padding: 18px;
6 min-height: calc(100% - 36px);
7 width: calc(100% - 36px);
8}
9
10.container--contents-centered {
11 justify-content: center;
12 align-items: center;
13}
14
15.container--no-padding {
16 padding: 0;
17}1.page {
2 --topbar-height: 80px;
3 max-width: 1216px;
4 margin: 0 auto;
5 padding: 48px calculated-sides;
6
7 // Responsive padding and width management
8 // Automatically adjusts for mobile, tablet, and desktop
9}
10
11.page--contents-max-width {
12 > * {
13 max-width: 780px;
14 }
15}
16
17.page--no-extra-padding {
18 --width-sections: calc(100% - 32px);
19 --padding-sections-left: 32px;
20}1@use '@san-siva/stylekit/styles/dimensions.module.scss' as dims;
2
3.card {
4 border-radius: dims.$border-radius--2;
5 max-width: dims.$max-width--page-contents;
6}
7
8.rounded-button {
9 border-radius: dims.$border-radius--1;
10}
11
12// Use built-in container
13.my-container {
14 @extend .container;
15 @extend .container--contents-centered;
16}Always use the spacing scale:
1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}1// Good: Use spacing scale
2.section {
3 margin-bottom: utils.space(4); // 32px from scale
4 padding: utils.space(3); // 24px from scale
5}
6
7// Avoid: Arbitrary values break consistency
8.section {
9 margin-bottom: 35px; // Don't do this
10 padding: 22px; // Don't do this
11}Use semantic color names:
1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}1// Good: Semantic naming makes intent clear
2.error-message {
3 color: colors.$color--error;
4 background: colors.$color--error-light;
5}
6
7.primary-button {
8 background: colors.$color--primary;
9 color: colors.$color--base;
10}
11
12// Avoid: Direct hex values lose semantic meaning
13.error-message {
14 color: #ff4232; // What does this color represent?
15}Stick to the type scale:
1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}1// Good: Use predefined sizes
2h1 {
3 font-size: type.$font-size--h1; // 36px
4}
5
6.small-text {
7 font-size: type.$font-size--small; // 12px
8}
9
10// Avoid: Random font sizes
11h1 {
12 font-size: 37px; // Why not 36px from the scale?
13}Combine utility classes effectively:
1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}1// Good: Compose utilities for rapid development
2<div className={`
3 ${styles['margin-bottom--4']}
4 ${styles['padding-top--3']}
5 ${styles['font-size--h2']}
6`}>
7 Content
8</div>
9
10// Also good: Use SCSS variables for complex components
11.complex-component {
12 margin-bottom: utils.space(4);
13 padding-top: utils.space(3);
14 font-size: type.$font-size--h2;
15 color: colors.$color--primary;
16}1// Import SCSS module
2import styles from '@san-siva/stylekit/styles/index.module.scss';
3
4export function Card({ children }) {
5 return (
6 <div className={styles['padding-top--4']}>
7 <h2 className={`${styles['font-size--h2']} ${styles['margin-bottom--2']}`}>
8 Card Title
9 </h2>
10 <div className={styles['margin-top--3']}>
11 {children}
12 </div>
13 </div>
14 );
15}1// component.scss
2@use '@san-siva/stylekit/styles/colors.module.scss' as colors;
3@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
4
5:host {
6 display: block;
7 padding: utils.space(4);
8}
9
10.card {
11 background: colors.$color--base;
12 border: 1px solid colors.$color--border;
13}1@use '@san-siva/stylekit/styles/utils.module.scss' as utils;
2
3// Define custom spacing
4$spacing-custom: utils.rem(72);
5
6.special-section {
7 margin-bottom: $spacing-custom;
8 // Or use the built-in space function
9 padding: utils.space(5); // 40px
10}1@use '@san-siva/stylekit/styles/typography.module.scss' as type;
2
3// Override with your font
4$custom-font-family: 'Your Font', sans-serif;
5
6.heading {
7 font-family: $custom-font-family;
8 // But still use StyleKit's scale
9 font-size: type.$font-size--h1;
10 font-weight: type.$font-weight--700;
11}