Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@universalstandard/ook

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universalstandard/ook

Ook is a dumb styling component for React. It's like [Rebass](https://rebassjs.org/), but the API is any camelCased CSS property and an elegant breakpoint pattern. It also uses styled-components@5 under the hood, so it looks really pretty in React Devtool

  • 6.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@universalstandard/ook

Ook is a dumb styling component for React. It's like Rebass, but the API is any camelCased CSS property and an elegant breakpoint pattern. It also uses styled-components@5 under the hood, so it looks really pretty in React Devtools (especially with the experimental branch).

Ook takes about 15 seconds to master.

Installation

yarn add @universalstandard/ook

Simple Example

import Ook from '@universalstandard/ook'

export default () => <Ook background="tomato">Eek!</Ook>

Demo

https://codesandbox.io/s/ook-58nxe

Example with Breakpoints

import Ook, { OokConfig } from '@universalstandard/ook'

const Eek = () => (
  <OokConfig
    breakpoints={{
      default: '0',
      tablet: '768px',
      desktop: '1440px',
    }}
  >
    <Ook
      fontFamily="sans-serif"
      color="white"
      background={{
        default: 'tomato',
        tablet: 'dodgerblue',
        desktop: 'hotpink',
      }}
      padding={{
        default: '2rem',
        desktop: '4rem',
      }}
    >
      <Ook fontWeight="bold">Eek!</Ook>
    </Ook>
  </OokConfig>
)

export default Eek

Props

By Default, Any camelCased CSS property

https://developer.mozilla.org/en-US/docs/Web/CSS/Reference#Keyword_index

Vendor prefixed props need camelCased with a _ in front instead of a -. E.g. <Ook _webkitFontSmoothing="antialiased">

cssProperties

There is an array of 1000+ CSS property names (most of which are never used in the real world) that are looped over for every <Ook> prop by default. It seems to perform fine, but it might not be fast enough for your needs. Feel free to pass your own array of kebab-cased CSS properties to <OokConfig cssProperties={yourArrayOfCssProps}>.... We're starting/updating/maintaining one at @universalstandard/common-css-properties if you'd like to contribute any CSS properties you use.

active, hover, focus, visited (object)

Support for pseudo classes:

<Ook
  background="tomato"
  color="white"
  hover={{
    background: 'dodgerblue',
    color: {
      tablet: 'springgreen'
    }
  }}
>
before, after (object)

Limited support for pseudo elements:

<Ook
  position="relative"
  after={{
    content: '',
    display: 'block',
    background: 'tomato',
    width: '100px',
    height: '100px'
  }}
>

Note: Pseudo classes (hover, etc.) and breakpoints within pseudo elements aren't currently supported but they will be in the future.

css (string)

styled-components css prop support as an escape hatch. Possibly handy for things like the lobotomized owl technique. Supports nesting and pseudo-classes/elements.

el (string)

Any valid HTML element, or React component, to render the <Ook> as. Defaults to div.

{...props}

Additional props work as expected.

el and css and additional props Example:
<Ook
  el="ul"
  background="hotpink"
  css={`
    > *:hover {
      background: springgreen;
    }
  `}
  onClick={() => console.log(123)}
>
  <li>a</li>
  <li>b</li>
  <li>c</li>
</Ook>

Tips

  • If you ever feel like you're looking at a mountain of <Ook>s, you should break your component down into smaller components with only a few <Ook>s and friendlier names. It sounds like cliche advice, but it's particularly applicable to Ook.

That's it. Have a banana for making it to the end. 🍌

FAQs

Package last updated on 02 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc