0.1.5 • Published 4 years ago

@impromptu/css v0.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

@impromptu/css

Tiny CSS-in-JS utilities.

Getting Started

import { stylesheet } from "@impromptu/css";

stylesheet({
  body: {
    padding: 0,
  },
});

API

Utilities

  • getId(prefix?)
    • Returns a unique identifier.
    • This function will work even if multiple versions of this library are in use.
  • getClassName(...classNames)
    • Alias: cx(...classNames)
    • Returns a normalized class name string.
    • If a falsy value is given, it will be omitted.
    • If a map of class names is given, only those with a value of true will be included.
  • getStyleText(style, namespaceSelector?)
    • Returns stylesheet text suitable for assignment to HTMLStyleElement.textContent.
  • stylesheet(...style)
    • Appends a global stylesheet to document head.
    • Returns the appended <style> element.

Constants

  • Em
    • A constant value of 16, which is the suggested width in pixels of 1em. All ResponsiveWidth values are a multiple of this constant.
  • ResponsiveWidth
    • Standard responsive min-width break points in pixels.