22.1.2 • Published 4 months ago

@textkernel/oneui v22.1.2

Weekly downloads
149
License
MIT
Repository
github
Last release
4 months ago

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';

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 isPrimary 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, except for color shades (e.g. --color-primary-25) which are computed when generating new themes. 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-primary: 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.

22.1.2

4 months ago

22.1.1

4 months ago

22.1.0

5 months ago

22.0.4

5 months ago

21.0.0

7 months ago

22.0.3

6 months ago

22.0.2

6 months ago

22.0.0

6 months ago

20.0.1

10 months ago

20.0.0

10 months ago

19.4.0

12 months ago

19.5.0

12 months ago

19.3.0

1 year ago

19.1.1-0

1 year ago

19.3.1

1 year ago

19.2.0

1 year ago

19.1.0

1 year ago

19.0.0

1 year ago

19.0.0-next.13

1 year ago

19.0.0-next.12

1 year ago

19.0.0-next.11

1 year ago

19.0.0-next.10

1 year ago

19.0.0-next.9

1 year ago

19.0.0-next.8

1 year ago

19.0.0-next.7

1 year ago

18.11.0

1 year ago

18.11.1

1 year ago

18.11.2

1 year ago

18.11.3

1 year ago

19.0.0-next.1

1 year ago

19.0.0-next.0

1 year ago

19.0.0-next.6

1 year ago

19.0.0-next.5

1 year ago

19.0.0-next.4

1 year ago

19.0.0-next.3

1 year ago

19.0.0-next.2

1 year ago

18.9.2

2 years ago

18.9.1

2 years ago

18.9.0

2 years ago

18.10.0

1 year ago

18.10.1

1 year ago

18.10.2

1 year ago

18.8.1

2 years ago

18.8.0

2 years ago

18.6.2

2 years ago

18.6.1

2 years ago

18.6.0

2 years ago

18.5.0

2 years ago

18.7.2

2 years ago

18.7.1

2 years ago

18.7.0

2 years ago

18.2.0

2 years ago

18.1.0

2 years ago

18.4.1

2 years ago

18.4.0

2 years ago

18.3.0

2 years ago

17.3.0

2 years ago

17.3.2

2 years ago

17.3.1

2 years ago

17.4.0

2 years ago

18.0.0

2 years ago

17.2.1

2 years ago

17.2.0

2 years ago

17.1.0

2 years ago

17.0.1

2 years ago

17.0.0

2 years ago

15.5.0

3 years ago

16.0.0

2 years ago

15.4.2

3 years ago

15.4.1

3 years ago

15.4.0

3 years ago

15.3.0

3 years ago

15.1.0

3 years ago

15.2.0

3 years ago

15.0.3

3 years ago

15.0.2

3 years ago

15.0.1

3 years ago

15.0.0

3 years ago

14.1.0

3 years ago

14.0.0

3 years ago

13.9.0

3 years ago

13.10.0

3 years ago

13.8.0

3 years ago

13.7.0

3 years ago

13.6.2

3 years ago

13.6.1

3 years ago

13.6.0

3 years ago

13.5.1

3 years ago

13.5.0

3 years ago

13.4.0

3 years ago

13.3.0

3 years ago

13.2.0

3 years ago

13.1.0

3 years ago

13.0.0

3 years ago

12.6.2

3 years ago

12.6.1

3 years ago

12.6.0

4 years ago

12.5.0

4 years ago

12.4.0

4 years ago

12.3.1

4 years ago

12.3.0

4 years ago

12.2.0

4 years ago

12.1.2

4 years ago

12.1.0

4 years ago

12.0.2

4 years ago

12.0.1

4 years ago

12.0.0

4 years ago

11.3.0

4 years ago

11.2.1

4 years ago

11.2.0

4 years ago

11.1.0

4 years ago

11.0.0

4 years ago

10.2.0

4 years ago

10.1.0

4 years ago

10.0.0

4 years ago

9.7.0

4 years ago

9.6.0

4 years ago

9.5.0

4 years ago

9.4.0

4 years ago

9.3.2

4 years ago

9.3.1

4 years ago

9.2.0

4 years ago

9.1.0

4 years ago

9.0.2

4 years ago

9.0.1

4 years ago

9.0.0

4 years ago

8.4.0

4 years ago

8.3.0

5 years ago

8.2.1

5 years ago

8.2.0

5 years ago

8.1.1

5 years ago

8.1.2

5 years ago

8.1.0

5 years ago

8.0.1

5 years ago

8.0.0

5 years ago

7.0.0

5 years ago

6.2.1

5 years ago

6.2.0

5 years ago

6.1.0

5 years ago

6.0.0

5 years ago

5.2.0

5 years ago

5.1.1

5 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.7.0

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago