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

vdux-base

v1.2.5

Published

Low-level presentational UI component

Downloads

12

Readme

base

js-standard-style

Low-level presentational UI component, inspired heavily (read: copied entirely) from rebass.

Installation

$ npm install vdux-base

Usage

This is not intended for direct use in application code. It's intended to be used as a low-level component consumed by other reusable UI components, though you're free to use it directly if you want as well.

Themes

Base looks for its theme in the baseTheme property of context. So when you run your app, just do:

import myTheme from './my-theme'

render(<App state={state} />, {baseTheme: myTheme})

Your theme will be extended over the default theme, which you can see here.

Rounding

You may pass:

  • circle=true as a prop and you'll get a circular element (i.e. borderRadius=99999px)
  • pill=true is an alias for circle
  • rounded=true sets borderRadius to borderRadius from your theme

Padding/margin

Padding and margin are specified by indexing into the scale array of your theme. Each padding/margin property accepts an index into that array, like this:

<Base px={1} /> -> <div style='padding-left: 4px; padding-right: 4px'></div>

You may specify p or m for each of these, but for simplicity i'll just write it out for padding:

  • p - Pad all sides
  • px - Pad the x-axis (i.e. left/right)
  • py - Pad the y-axis (i.e. top/bottom)
  • pt - Pad the top
  • pl - Pad the left side
  • pr - Pad the right side
  • pb - Pad the bottom

Colors

You can also specify colors in your theme, and then reference those colors by name in the color and bgColor props. E.g.

import Base from 'vdux-base'

Base.setBaseTheme({
  colors: {
    ...Base.theme.colors,
    error: 'red'
  }
})

function render ({props}) {
  return <Base color='red'>{props.errorMessage}</Base>
}

But you may also pass any valid color string and it will be passed on through if there is no corresponding key in the theme's color map.

baseStyle

If you are creating a reusable component and you want to add custom style properties, you should use the baseStyle prop to add your style, and then forward the style prop, which will supercede anything in baseStyle or anything set by the <Base/> component itself.

License

MIT