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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ndla/primitives

v1.0.125-alpha.0

Published

Primitive components for NDLA.

Readme

@ndla/primitives

A set of primitive components used throughout ndla packages and websites. Mostly styled versions of components from ark-ui

Installation

yarn add @ndla/primitives

This package relies on our styled system, which can be consumed through PandaCSS or plain css. Read about setting it up in @ndla/preset-panda.

Guidelines

Primitives should be multi-use

A primitive should be multi-purpose and low-level enough to be composed any which way a user wishes to. If you're creating a one-off component or a component witha limited set of capabilities, consider if it makes more sense in a different package.

Keep "global" dependencies to a minimum

We try not to impose any technological restrictions on consumers of the primitives; A consumer should for instance be able to choose their own translation or routing libraries.

Variant usage in primitives

This section does not apply to sva usage, as variant overriding is simple there :)

Variants are a blessing and a curse. They provide a clean and structured way of presenting a set of predefined options to users. At the same time, they're a nightmare to override when restyling a primitive.

const Button = styled("button", {
  base: {
    color: "text.default",
  },
  variants: {
    primary: {
      background: "suface.action",
      _hover: {
        background: "surface.action.hover",
      },
    },
    subtle: {
      background: "surface.actionSubtle",
      _hover: {
        background: "surface.actionSubtle.hover",
      },
    },
  },
});

// You get the idea
const StyledButton = styled(Button, {
  variants: {
    primary: {
      background: "stroke.default",
      _hover: {
        background: "stroke.default",
      },
    },
  },
});

Instead, define primitives with variants with the cva function. This allows us to invoke the cva function so we can merge the result with whatever value the restyled component has.

const buttonRecipe = cva({
  base: {
    color: "text.default",
  },
  variants: {
    primary: {
      background: "suface.action",
      _hover: {
        background: "surface.action.hover",
      },
    },
    subtle: {
      background: "surface.actionSubtle",
      _hover: {
        background: "surface.actionSubtle.hover",
      },
    },
  },
});

// If you want it to support `asChild`
const StyledButton = styled(ark.button, {}, { baseComponent: true });

const Button = forwardRef<HTMLButtonElement, ComponentPropsWithRef<"button"> & RecipeVariantProps<typeof buttonRecipe>>(
  // You need to extract the css prop and any variant props
  ({ css: cssProp, variant, ...props }, ref) => {
    return <StyledButton css={css.raw(buttonRecipe.raw({ variant }), cssProp)} {...props} ref={ref} />;
  },
);

const RestyledButton = styled(Button, {
  base: {
    background: "stroke.default",
    _hover: "stroke.default",
  },
});

This leads to slightly more code, but more intuitive styling options for the consumer