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

@daohaus/ui

v0.5.4

Published

The UI component library is organized into various component levels: _Atoms_, _Molecules_, _Organisms_, and _Layouts_. This organization allows you to install the entire package or pick the components you need. Even though we bundle many elements together

Downloads

207

Readme

Component Library (UI) / @daohaus/ui

The UI component library is organized into various component levels: Atoms, Molecules, Organisms, and Layouts. This organization allows you to install the entire package or pick the components you need. Even though we bundle many elements together, we also provide the primitives when possible. If a molecule doesn't suit your needs, you can reconstruct it as you wish.

Inspect components in Storybook

View on NPM

Usage

Running Storybook Locally

Run nx ui:storybook

Installation

yarn add @daohaus/ui

Initially, import the HausThemeProvider from the @daohaus/ui package in your app's root component, such as main.tsx. This wraps the entire application and avails its data to other components

// main.tsx

import { HausThemeProvider } from '@daohaus/ui';

ReactDOM.render(
  <StrictMode>
    <HausThemeProvider>
      <HashRouter>
        <HausConnectProvider>
          <Routes />
        </HausConnectProvider>
      </HashRouter>
    </HausThemeProvider>
  </StrictMode>,
  document.getElementById('root')
);

Examples

There are examples of most component in our Storybook

How to use Components

You can import individual components from the @daohaus/ui package and utilize them in your app:

import { Button } from '@daohaus/ui';

<Button color="secondary" onClick={somAction} IconLeft={<SomeIcon />}>
  Button content
</Button>;

How to override the theme.

The theme.ts file establishes base styles for components, leveraging the Radix open-source color system. The <HausThemeContext> sets state variables for primary, secondary, tertiary, neutral, and utility colors.

Daefult DAOhaus theme

You can override this theme by passing a new theme or parts of the theme to the themeOverrides prop on the HausThemeProvider

How to use the toast hook

import { useToast } from '@daohaus/ui';

const { successToast } = useToast();

successToast({
  title: 'Toast title',
  description: 'Some content',
});

How to use the media query hook

import { useBreakpoint, widthQuery } from '@daohaus/ui';

const isMobile = useBreakpoint(widthQuery.sm);

<Button full={isMobile} />;

Components Overview

Our component library includes the following, and each of the components has an associated Story for more deatiled usage.

  • Animations: Our animations commonly used throughout the app.
  • Components: We roughly follow Atomic Design principles so our components are organized as Atoms, Molecules, and Organisms
    • Atoms
      • These are the smallest components that are used to build up a larger component. Each Atom is typically a single UI element such as a <Label> component.
    • Molecules
      • Molecules are composed of Atoms and other Molecules. Molecules are typically used to build up a larger component. An example is an <Toast/> component as it composes other Atoms.
    • Organisms
      • These are the largest components. As our component library is largely comprised of building blocks intended to be composed together, we currently have fewer at this level than the others as most Organisms exist in the individual apps.
  • Hooks
    • Hooks are React Hooks that are used to provide additional functionality to our components. For example, we have a useMediaQuery hook that supports responsive design.
  • Theme
    • Our theme and base styles for several components. We have a HausThemeContext that composes and scaffolds core theme elements.
  • Types
    • Common types used throughout the component library.

Building

Run nx ui:build to build the library.