3.0.0-beta.10 • Published 2 years ago

uniform-ui v3.0.0-beta.10

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

Installation

Manual

Download compiled CSS and JS: http://uniform-ui.com/uniform.zip

Link to css and js in html document:

<link rel="stylesheet" href="/uniform.css" type="text/css" media="screen" charset="utf-8">
<script src="/uniform.js"></script>

Ruby

Add this line to your application's Gemfile:

gem 'uniform-ui'

Add Uniform assets to asset paths

Example for Condenser:

condenser.path = Dir.each_child(UniformUi::ASSET_PATH).map { |a| File.join(UniformUi::ASSET_PATH, a) }

NPM

npm install uniform-ui
import {Dropdown} as Uniform from 'uniform';

new Uniform.Dropdown({
    el: $('.example')
})

Media Query Combiner

The breakpoint utilities can bloat the library by 30ish%. Use a media query combiner to condense the mean media queries into batches.

For Rails Sprockets: https://github.com/aaronjensen/sass-media_query_combiner

For Rails Condenser: https://github.com/malomalo/condenser

env.register_postprocessor('text/css', ::Condenser::CSSMediaCombinerProcessor)

Usage

Checkout the documentation

Configuration

Define configuration by setting keys of $uniform_configs prior to @import 'uniform'; $uniform_configs is deep merged with defaults giving $uniform_configs priority. To remove default keys give them value of false.

Example

$uniform_configs: (
    sizes: (
        padding: (
            "8x": "8rem"
        )
    ),
    colors: (),
    pseudo_classes: (
        "hover": hover,
    ),
    combinators: (
        ">": ">"
    ),
    breakpoints: (
        include_containers: true,
    )
)
@import 'uniform';

Sizes

Size modifiers give a type of utility a size by postfixing to the type with a - (ex. margin-bottom-2x). Sizes are defined per type.

Extending $uniform_configs.sizes

keydefaultsdescription
bordernone, 2px, 3px, 4pxborder-width
dividenone, 2px, 3px, 4pxborder-between objects
roundednone, xs, sm, lg, xlborder-radius
marginnone, 1/4x, 1/2x, 3/4x, xs, sm, lg, xl, 2xspace around object
gapnone, xs, sm, lg, xlgap in grid
spacenone, xs, sm, lg, xl, 2x, 4xspace between objects
padnone, 1/4x, 1/2x, 3/4x, xs, sm, lg, xl, 2xpadding of an object
textxs, sm, lg, xl, 2x, 4x, 8xfont-size of text
strokesm, md, lg, 2x, 3xstroke of svg

Colors

Color modifiers build out an entire spectrum of utility classes related to color.

Extending $uniform_configs.colors

You can configure a color to a color (hex, hsl, rgb...), false, or a hash (options below). Setting to a color ignores options for the color (mainly spectrum option). Setting to false removes the color (this is helpful to remove a uniform default color).

Defaults

Options for $uniform_configs.colors.[color]

keytypedescriptiondefault
spectrumBooleanexpand the given color to a spectrum of lightness (10) to darkness (90) (ex. text-red-30)false
colorHex, HSL, RGBcolor value of key
[key]Hex, HSL, RGBany extra key given will create an additional color with the given key as postfix modifier of the key (ex. red: (light: #E1563E) will produce .text-red-light{color: #E1563E})

Combinators

Combinator modifiers give most utility classes the ability to apply a utility to the combinator by postfixing the combinator with [utility]-[combinator] (ex. margin-bottom->) Example

$uniform_configs: (
    combinators: (">": ">")
)

Generates

.margin-bottom-> > * {
    margin-bottom: 1em;
}

Pseudo Classes

Pseudo class modifiers give most utility classes the ability to scope to the given pseudo class by prefixing a utility with [pseudo class]:[utility]. (ex hover:text-red).

Example

$uniform_configs: (
    pseudo_classes: (hover: "hover")
)

Generates

.hover:text-red {
    color: #E1563E;
}

Group Hover

There is one predefined pseudo class for group-hover. If the key group-hover is set then the following will be generated:

.group:hover{
    .group-hover:bg-blue {
        background: #0994E2
    }
}

Breakpoints

Breakpoint modifiers give most utility classes the ability to be responsive by prefixing a utlity with [breakpoint]:[utility] (ex. md:margin-top), so that that utility is only applied in the given media query.

Example

$uniform_configs: (
    breaking_points: (
        include_containers: true,
        mobile: "max-width: 719px"
    )
)

Generates

@media only screen and (min-width: 720px){
    .mobile:margin-top {
        margin-top: 1em;
    }
}
.mobile-container .margin-top {
    margin-top: 1em;
}

Options for $uniform_configs.breakpoints

keytypedescriptiondefault
include_containersBooleantoggle including containers for breakpoints like .md-container > md:margin-topfalse
[key]media queryany key given will create a breakpoint with given key as utility name and value as the media query

Browser Support

IE / EdgeFirefoxChromeSafari
IE11, Edge52+59+9+

Development

Docs are generated using Middleman

To run server

middleman server

To package:

middleman build
3.0.0-beta.10

2 years ago

3.0.0-beta.8

3 years ago

3.0.0-beta.5

3 years ago

3.0.0-beta.4

3 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.9

4 years ago

2.3.8

4 years ago

2.3.7

4 years ago

2.3.6

4 years ago

2.3.5

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.3.2

4 years ago

0.1.1

4 years ago