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

@splunk/react-ui

v4.39.0

Published

Library of React components that implement the Splunk design language

Downloads

6,385

Readme

@splunk/react-ui

A library of UI components that implement the Splunk design language in React.

Install

Install the package and its dependencies.

  1. Install the peer dependencies:
    npm install react@^16 react-dom@^16 styled-components@^5
  2. Install the package:
    npm install @splunk/react-ui

Production builds

@splunk/react-ui and React support production and development builds. The production build removes warnings and guidance from the output. To create a production build, set the environment variable NODE_ENV to "production" and use the webpack DefinePlugin to inject the variable into the code.

Use the components

Children

Nearly all components accept node children. Only components that require specific constraints include information about the children prop in its documentation.

Styling

  • Pass style to control layout, margins, or positioning. See the following example:

    <Button label="Hello" style={{ flexBasis: '200px' }} />
  • Alternatively, you can use a component's inline prop to switch between inline-block/inline-flex and block/flex. You can use this prop instead of passing a style prop. See the following example:

    <Button inline={false} />
  • Avoid using className.

  • Avoid overriding style sheets. When selector specificity changes, the change can break style sheet overrides.

The generated markup isn't an API and may change at any time without notice, even in a patch release. The selector specificity also isn't an API and may change at any time without notice.

Refs / elementRef

All components support an elementRef prop. It behaves similar to a React ref, but its value is guaranteed to be the main DOM element of the component, if mounted. In contrast, the value of a regular ref on a mounted class component is the component instance.

Defining fonts

The component library doesn't include fonts. You must define and load fonts in a @font-face declaration. By default, the components render in "Splunk Platform Sans", an alias of "Proxima Nova", and "Splunk Platform Mono", an alias of "Inconsolata".

Please make sure to obtain all required font licenses.

For quick reference, most themes use the following font-family stack:

Sans (default): Splunk Platform Sans, Proxima Nova, Roboto, Droid, Helvetica Neue,
    Helvetica, Arial, sans-serif;
Mono: Splunk Platform Mono, Inconsolata, Consolas, Droid Sans Mono, Monaco,
    Courier New, Courier, monospace;

Individual themes might use different fonts.

Version compatibility

It is strongly recommended to include only one instance of @splunk/react-ui in an application bundle. Likewise, using multiple instances of this library on the same page is discouraged.

| Multiple instances | @splunk/react-ui 4.x    | @splunk/react-ui 4.x and 3.x |
| ------------------ | ----------------------- | ---------------------------- |
| In the same bundle | Deduplicate             | Avoid                        |
| On the same page   | Avoid                   | Avoid                        |

In the same bundle

Multiple instances of @splunk/react-ui in the same bundle should be avoided. For example, instead of 4.0.0 and 4.1.0 only 4.1.0 should be used. Multiple versions of 3.x are not supported. Use a package manager (Yarn or NPM) or a module bundler (Webpack) to deduplicate versions.

1. Yarn or NPM:

yarn and npm resolve dependencies to avoid duplicate versions.

Pros:

  • Supports 4.x and 3.x in the same bundle.

Cons:

  • Extra versions can unexpectedly be added to lock files while updating dependencies.
  • Upgrades may require rebuilding the lock file.
  • All packages must all define their @splunk/react-ui dependency with a major version (@^4.0 or @^4.1), not a minor version (@~4.0).
2. Webpack:

Webpack's alias feature can force a single version of @splunk/react-ui to be used throughout the dependency tree.

Pros:

  • Reliably builds with one version of @splunk/react-ui.

Cons:

  • Cannot be used when 3.x and 4.x are required by different dependencies.
  • If dependencies rely on a newer version, unexpected breakages may occur.

On the same page

While it's generally discouraged to run multiple instances of @splunk/react-ui on the same page, legacy environments exist that may have this requirement. A utility that can help with this scenario is LayerStackGlobalProvider in the Layer component.

Other libraries

If React Hooks are used, the react and react-dom packages should be deduplicated as described above.

styled-components, a dependency of this library, comes with its own rules and restrictions regarding multiple instances. It should always be deduplicated, and using its SC_ATTR feature is recommended. @splunk/webpack-configs enables it by default.

Further reading: