5.0.0-beta.5 • Published 2 months ago

@vitalsource/vstui v5.0.0-beta.5

Weekly downloads
347
License
MIT
Repository
github
Last release
2 months ago

vstui

vstui is a set of React components based off the VitalSource Pattern Library. The goal of this project is to have a solid set of accessible components that follow our style guidelines.

You can check the release notes to see what has changed in each release.

Getting started

Installation

Download

To download vstui, run one of the following from the command line. Make sure to look at the output, and install any missing peer dependencies.

yarn add @vitalsource/vstui
# don't forget to install any missing peer dependencies!

or

npm install @vitalsource/vstui
# don't forget to install any missing peer dependencies!

Embed fonts

vstui uses the font Roboto, but it's not included as part of this package.

To embed Roboto into a webpage, copy this code into the <head> of your HTML document.

Note: This doesn't work in China, so it might be a good idea to self-host the font.

<link
  href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700"
  rel="stylesheet"
/>

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import { magic, sangria } from '@vitalsource/vstui/colors';
import { createTheme, ThemeProvider } from '@vitalsource/vstui/themes';
import { Button } from '@vitalsource/vstui';

const theme = createTheme({
  color: {
    primary: magic,
    secondary: sangria,
  },
});

function App() {
  return (
    <ThemeProvider theme={theme}>
      {
        // This is where all your site code goes
        // The theme prop will get passed down to all vstui components,
        // even when they are multiple levels deep
      }
      <div>
        <Button>Button with magic theme</Button>
        <Button secondary>Button with sangria theme</Button>
      </div>
    </ThemeProvider>
  );
}

ReactDOM.render(<App />, document.getElementById('root'));

Edit vstui usage demo

Localization

Messages included with vstui (things like default form validation messages) are translated into all the languages supported by Bookshelf.

It is important to update your theme to reflect your app's current locale. It's highly recommended to dynamically load these languages or only bundle those that you require - loading them all amounts to about 20kb gzipped.

See the translations folder for the list of currently supported languages.

...
import { es } from "@vitalsource/vstui/i18n/translations";

const theme = createTheme({
  i18n: es
});
...

See a full working example here: Edit vstui i18n demo

Supported browsers

The browsers we support are the same as the browsers supported by Bookshelf Online

Contributing

If you'd like to help out developing these components, please see the contribution guidelines.

Related Projects

  • a11y-dialog A very lightweight and flexible accessible modal dialog.
  • formik Build forms in React, without the tears 😭
  • material-ui React components that implement Google's Material Design.
  • react-popper React wrapper around Popper.js
5.0.0-beta.5

2 months ago

5.0.0-beta.4

2 months ago

5.0.0-beta.3

3 months ago

5.0.0-beta.2

3 months ago

5.0.0-beta.1

3 months ago

4.1.6

5 months ago

4.0.1-2

9 months ago

4.0.1-3

9 months ago

4.0.1-0

10 months ago

4.0.1-6

9 months ago

4.0.1-7

9 months ago

4.0.1-4

9 months ago

4.0.1-5

9 months ago

4.0.1-8

9 months ago

4.1.4

6 months ago

4.1.3

8 months ago

4.1.5

6 months ago

4.1.0

9 months ago

4.1.2

9 months ago

4.1.1

9 months ago

4.0.0

11 months ago

4.0.0-beta.14

1 year ago

4.0.0-beta.13

1 year ago

4.0.0-beta.12

1 year ago

4.0.0-beta.11

1 year ago

4.0.0-beta.10

2 years ago

4.0.0-beta.8

2 years ago

4.0.0-beta.7

2 years ago

4.0.0-beta.9

2 years ago

4.0.0-beta.6

2 years ago

3.31.0

2 years ago

3.30.0

2 years ago

4.0.0-beta.5

2 years ago

4.0.0-beta.4

2 years ago

4.0.0-beta.3

2 years ago

4.0.0-beta.2

2 years ago

3.29.0

2 years ago

4.0.0-beta.1

2 years ago

3.28.0

2 years ago

3.28.1

2 years ago

3.27.0

2 years ago

3.24.0

2 years ago

3.25.0

2 years ago

3.26.0

2 years ago

3.26.1

2 years ago

3.22.3

2 years ago

3.23.1

2 years ago

3.23.0

2 years ago

3.23.2

2 years ago

3.22.0

3 years ago

3.22.2

3 years ago

3.22.1

3 years ago

3.21.1

3 years ago

3.21.0

3 years ago

3.20.0

3 years ago

3.19.0

3 years ago

3.18.0

3 years ago

3.17.1

3 years ago

3.17.0

3 years ago

3.16.0

3 years ago

3.15.1

3 years ago

3.15.0

3 years ago

3.14.0

3 years ago

3.13.0

3 years ago

3.12.0

3 years ago

3.11.0

3 years ago

3.10.1

3 years ago

3.10.0

3 years ago

3.9.0

3 years ago

3.8.0

3 years ago

3.7.0

3 years ago

3.6.0

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.5

3 years ago

3.2.4

3 years ago

3.2.3

3 years ago

3.2.2

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

2.5.0

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.1.0-3

5 years ago

1.1.0-2

5 years ago

1.1.0-1

5 years ago

1.1.0-0

5 years ago

1.0.0

5 years ago

1.0.0-alpha.31

5 years ago

1.0.0-alpha.30

5 years ago

1.0.0-alpha.29

5 years ago

1.0.0-alpha.28

5 years ago

1.0.0-alpha.27

5 years ago

1.0.0-alpha.26

5 years ago

1.0.0-alpha.25

5 years ago

1.0.0-alpha.24

6 years ago

1.0.0-alpha.23

6 years ago

1.0.0-alpha.22

6 years ago

1.0.0-alpha.21

6 years ago

1.0.0-alpha.20

6 years ago

1.0.0-alpha.19

6 years ago

1.0.0-alpha.18

6 years ago

1.0.0-alpha.17

6 years ago

1.0.0-alpha.16

6 years ago

1.0.0-alpha.15

6 years ago

1.0.0-alpha.14

6 years ago

1.0.0-alpha.13

6 years ago

1.0.0-alpha.12

6 years ago

1.0.0-alpha.11

6 years ago

1.0.0-alpha.10

6 years ago

1.0.0-alpha.9

6 years ago

1.0.0-alpha.8

6 years ago

1.0.0-alpha.7

6 years ago

1.0.0-alpha.6

6 years ago

1.0.0-alpha.5

6 years ago

1.0.0-alpha.4

6 years ago

1.0.0-alpha.3

6 years ago

1.0.0-alpha.2

6 years ago