npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sass-flexbox-mixins

v1.0.1

Published

A collection of useful SCSS mixins for flexbox layouts

Downloads

14

Readme

SCSS Flexbox Mixins

A modern collection of SCSS mixins for flexbox layouts with a clean, map-based API that makes styling flexible layouts quick and intuitive.

Installation

npm install sass-flexbox-mixins

Usage

Import the mixins in your SCSS file:

@use 'sass-flexbox-mixins' as flex;

Or if you're using older SCSS syntax:

@import '~sass-flexbox-mixins';

Available Mixins

🎯 @mixin flex() - Complete Flex Container

The main mixin supporting all flex container properties with string-based values for better readability.

@mixin flex(
  $direction: "row",
  $wrap: "nowrap", 
  $justify-content: "start",
  $align-items: "stretch",
  $align-content: null,
  $gap: null,
  $row-gap: null,
  $column-gap: null
)

Parameters:

  • $direction: "row" | "row-reverse" | "column" | "column-reverse"
  • $wrap: "nowrap" | "wrap" | "wrap-reverse"
  • $justify-content: "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly"
  • $align-items: "start" | "center" | "end" | "stretch" | "baseline"
  • $align-content: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly"
  • $gap, $row-gap, $column-gap: Any CSS length value

🎯 @mixin flex-item() - Complete Flex Item Control

Controls all flex item properties.

@mixin flex-item(
  $grow: null,
  $shrink: null,
  $basis: null,
  $align-self: null,
  $order: null
)

Parameters:

  • $grow: Number (flex-grow value)
  • $shrink: Number (flex-shrink value)
  • $basis: CSS length or auto
  • $align-self: "auto" | "start" | "center" | "end" | "stretch" | "baseline"
  • $order: Number (visual order)

🎯 @mixin flex-row() - Row Shortcut

Quick setup for row layouts.

@mixin flex-row($justify-content: "start", $align-items: "stretch")

🎯 @mixin flex-column() - Column Shortcut

Quick setup for column layouts.

@mixin flex-column($justify-content: "center", $align-items: "stretch")

Examples

Basic Usage

// Simple centered container
.hero {
  @include flex.flex("row", "nowrap", "center", "center");
}

// Column layout
.sidebar {
  @include flex.flex-column();
}

// Row with space between
.navbar {
  @include flex.flex-row("space-between", "center");
}

Advanced Layouts

// Grid-like layout with gaps
.card-grid {
  @include flex.flex(
    $direction: "row",
    $wrap: "wrap", 
    $justify-content: "start",
    $align-items: "stretch",
    $gap: 1rem
  );
  
  .card {
    @include flex.flex-item(
      $grow: 1,
      $basis: 300px
    );
  }
}

// Responsive navigation
.navbar {
  @include flex.flex-row("space-between", "center");
  
  .logo {
    @include flex.flex-item($shrink: 0);
  }
  
  .nav-links {
    @include flex.flex(
      $direction: "row",
      $gap: 2rem
    );
  }
  
  .user-menu {
    @include flex.flex-item($shrink: 0);
  }
}

// Sidebar layout
.app-layout {
  @include flex.flex-row();
  min-height: 100vh;
  
  .sidebar {
    @include flex.flex-column();
    @include flex.flex-item(
      $basis: 250px,
      $shrink: 0
    );
  }
  
  .main-content {
    @include flex.flex-item($grow: 1);
  }
}

Real-World Components

// Card component
.card {
  @include flex.flex-column("space-between");
  
  .card-header {
    @include flex.flex-row("space-between", "center");
  }
  
  .card-content {
    @include flex.flex-item($grow: 1);
  }
  
  .card-footer {
    @include flex.flex-row("end", "center");
    @include flex.flex-item($shrink: 0);
  }
}

// Modal dialog
.modal {
  @include flex.flex("row", "nowrap", "center", "center");
  
  .modal-content {
    @include flex.flex-column();
    @include flex.flex-item($basis: 500px);
  }
}

Key Features

String-based API - Use intuitive strings like "center" instead of flex-start
Smart defaults - Sensible defaults for common use cases
Complete coverage - All flexbox properties supported
Modern SCSS - Uses @use and Sass maps for consistency
Zero dependencies - Pure SCSS, no external dependencies
TypeScript-friendly - Clear parameter types and values

Browser Support

Supports all modern browsers with flexbox support:

  • Chrome 29+
  • Firefox 28+
  • Safari 9+
  • Edge 12+
  • iOS Safari 9+
  • Android Browser 4.4+

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.