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 🙏

© 2024 – Pkg Stats / Ryan Hefner

unocss-preset-fluid

v1.0.2

Published

A fluid preset for unocss

Downloads

2,331

Readme

Unocss Preset Fluid

UnoCSS Preset Fluid offers an elegant solution to scale typography and spacing fluidly across different screen sizes without the need for breakpoints. Inspired by Utopia, this preset simplifies the creation of responsive designs in UnoCSS.

Installation

Install the preset alongside UnoCSS using your preferred package manager:

npm i unocss-preset-fluid unocss --save-dev # with npm
yarn add unocss-preset-fluid unocss -D # with yarn
pnpm add unocss-preset-fluid unocss -D # with pnpm

Usage

To use the preset in your UnoCSS configuration:

import { defineConfig } from 'unocss'
import { presetFluid } from 'unocss-preset-fluid'

export default defineConfig({
  presets: [
    presetFluid({
      // options
    }),
  ],
})

Examples and Documentation

Homepage
Examples

Options

Define your fluid design parameters with these options:

{
    maxWidth: 1440,
    minWidth: 375,
    extendMaxWidth: null,
    extendMinWidth: null,
    remBase: 16,
    useRemByDefault: false,
    ranges: null,
    commentHelpers: false,
}

Options Explained

  • MaxWidth: The maximum width in pixels where the fluid scaling stops growing.
  • MinWidth: The minimum width in pixels where the fluid scaling stops shrinking.
  • ExtendMaxWidth: Allows fluid scaling beyond MaxWidth while maintaining the proportion set by MaxWidth and MinWidth.
  • ExtendMinWidth: Allows fluid scaling below MinWidth while maintaining the proportion set by MaxWidth and MinWidth.
  • RemBase: The base value for REM unit calculations.
  • UseRemByDefault: When set to true, enables REM units as the default unit of measurement.
  • Ranges: Define named ranges for recurring spacings, creating handy aliases.
  • CommentHelpers: Enable to add helpful comments in the generated CSS, visible in the browser's inspector tool.

UseRemByDefault

If you are working with rem units, you can set this to true. This will make the fluid use rem by default.
For example

<div class="f-w-16-32">...</div> <!-- Default from 16px to 32px -->
<div class="f-w-1-2">...</div> <!-- RemByDefault from 1rem to 2rem -->

Ranges

This option allows you to define recurring spacings using predefined names. For example. With this fluid ranges:

{
  xs: [12, 16],
  sm: [14, 18],
  md: [18, 24],
  lg: [22, 30],
}

You will be able to use it as aliases. Therefore, f-w-xs will become f-w-12-16.

CommentHelpers

This option allows you to add comments to the generated css. After setting this to true, you will be able to see the generated css in the browser inspector.

.f-p-lg {
  padding: clamp(1.25rem, 0.5898rem + 2.8169vw, 3.125rem); /* 20px -> 50px */
}

.f-p-32-64 {
  padding: clamp(2rem, 1.2958rem + 3.0047vw, 4rem); /* 32px -> 64px */
}