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

@textkernel/oneui

v28.0.0

Published

Library of reusable React components with theming support

Downloads

1,703

Readme

Textkernel OneUI

npm version check Coverage Status Language grade: JavaScript Libraries.io dependency status for GitHub repo npm bundle size

Library of reusable React components with theming support

Getting started

For live examples of all OneUI components, click here.

Install with npm

Within your project’s frontend root, install the package from NPM. Make sure it’s marked as production dependency.

$ npm i '@textkernel/oneui'

Set up boilerplate

Import OneUI base stylesheet

In your application main Javascript, make sure to import the OneUI base stylesheet. The base stylesheet includes the default OneUI theme.

import '@textkernel/oneui/dist/oneui.min.css';

Assign base class to <body>

Assign the base class that has all font definitions to or to

<body class="OneUI-body-text">
    ...
</body>

Custom themes and browser support

To enable support for older browsers that don’t support CSS variables natively and to apply custom a theme, OneUI comes with a utility that takes on all of these responsibilities. See Theming for more on custom themes.

To apply a specific theme on top of the library components, the OneUI utility can be used to parse the provided theme file:

import OneUI from '@textkernel/oneui';

OneUI.init({
    themeURL: 'http://theme-cdn.com/my-theme.css',
}).then(() => ReactDOM.render(<MyApp />, document.getElementById('root')));

The utility can take three optional arguments:

  • themeURL: URL that provides the file containing the CSS variables that will be used instead of the default ones.
  • maxTime: The maximum amount of time in milliseconds that the loader will wait to parse the external theme, otherwise it will fallback to the default library theme. By default, the timeout is set to 2000 milliseconds.
  • ponyfillOptions: Allow the developer to override the default css-vars-ponyfill configuration.

IE11 support

OneUI relies on browser support for CSS variables. Support for older browsers such as IE11 can be enabled by using a polyfill. Using the previously mentioned utility will take care of it automatically.

Using components

  1. Import the desired UI component(s) from the library, e.g.:
import { Button } from '@textkernel/oneui';
  1. Include the component on your page:
<Button type="submit">This is a button</Button>

Undocumented props

Please note that any properties that are not documented in the component prop types definition are applied to the top level HTML element unless mentioned otherwise. These undocumented props are also not described in Storybook.

Storybook

OneUI comes with a Storybook of examples for all components. Click here to check it out.

In order to run it yourself locally...

  1. Make sure you have Storybook installed (globally):
$ npm i -g @storybook/cli
  1. Within the OneUI root, run npm run storybook
  2. Go to http://localhost:9001 to check out examples of all OneUI components

Theming

All CSS variables (‘custom properties’) exposed by OneUI can be customized. A theme file is an additional stylesheet that consists of a reassignment of all variables with values that are different from their defaults. Theme files should not contain any CSS selectors or properties - only CSS variables and values, e.g.:

--color-brand-50: red;
--font-size-base: 12px;

Contributing

  • Did you find a bug or do you have a feature proposal? Please open a new issue.
  • If your IDE does not support EditorConfig, please install a plugin (e.g. for VS Code).
  • Please make sure to read the developer guidelines before contributing.

Copyright

Code and documentation © 2020 Textkernel B.V.