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

@beaverbuilder/box

v0.0.4

Published

A tiny react box component suited to fast UI building.

Downloads

3

Readme

@beaverbuilder/box

This is a tiny (2kb) react component that makes creating container elements really quick. There is no stylesheet required, all styles are applied using js. The only dependency is react.

import b from '@beaverbuilder/box'

const MyComponent = () => (
	<>
		{ /* Use as any html tag */ }
		<b.div />

		{ /* Quick Padding */ }
		<b.span pad />
		<b.div padY={20} />
		<b.div pad="sm" />
		<b.div padX="30px" padY="40px" />

		{ /* Aspect Ratio Boxes */ }
		<b.div ratio="1:2">Aspect Ratio Box</b.div>
		<b.div ratio="video" />

		<b.square /> { /* Same as `<b.div ratio="square" />` */ }
		<b.poster /> { /* Shorthand for a 3:4 aspect ratio div */ }

		{ /* Flexbox Shorthand */ }
		<b.span column />
		<b.row gap={10} />
		<b.column tag="section" />
	</>
)

Flexbox

Since flexbox is used so frequently when constructing UI, the box component has a few shorthand ways to create flex containers. You can use b.column and b.row to create flexbox div elements quickly.

<b.column>I am a `display: flex; flex-direction: column` container element.</b.column>
<b.column tag="span" />

You can use the tag="span" prop to create a column or row with something other than a div element.

The gap prop is a shorthand for setting style={ { gap: '5px' } }. Be aware of browser support for this property - at the present the gap property for flexbox is supported in Chrome, Firefox, Edge(Chromium) and the Safari Technology Preview. If supported, direct child elements with have the specified space (gap) between each of them. <b.row gap={5}> Button One Button Two Button Three </b.row>


## Error Boundaries
Any box can optionally contain an error boundary by setting the `errorBoundary` prop. This prevents js errors from bubbling up to the parent elements.
<b.div errorBoundary>
	<SomeShadyComponent />
</b.div>
The error will be caught within the div and will display the error message. You can optionally provide a fallback component that will present in the event of an error.

const MyCustomFallback = ( { error } ) => ( <> We have a problem! { error.message } </> ) const MyUI = () => ( <b.div errorBoundary={ MyCustomFallback }> </b.div> )


## Peer Dependencies
* React