3.3.43 • Published 28 days ago

@boxyhq/react-ui v3.3.43

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
28 days ago

@boxyhq/react-ui

UI components from BoxyHQ for plug-and-play enterprise features.

Installation

npm install @boxyhq/react-ui --save

Usage

SSO Login Component

There are mainly 2 ways of using the SSO Login Component as outlined below:

Preset value for ssoIdentifier

If a value is passed for ssoIdentifier, it would render a button that on click calls the passed-in handler (onSubmit) with the ssoIdentifier value. The handler can then initiate a redirect to the SSO service forwarding the value for ssoIdentifier.

import { Login as SSOLogin } from '@boxyhq/react-ui/sso';

const onSSOSubmit = async (ssoIdentifier: string) => {
  // Below calls signIn from next-auth. Replace this with whatever auth lib that you are using.
  await signIn('boxyhq-saml', undefined, { client_id: ssoIdentifier });
};

<SSOLogin
  buttonText={'Login with SSO'}
  ssoIdentifier={`tenant=${tenant}&product=${product}`}
  onSubmit={onSSOSubmit}
  classNames={{
    container: 'mt-2',
    button: 'btn-primary btn-block btn rounded-md active:-scale-95',
  }}
/>;

Accept input from the user for ssoIdentifier

If a value is not passed for ssoIdentifier, it would render an input field for the user to enter the ssoIdentifier value. And then on submit, the value gets passed to the handler. The handler can then initiate a redirect to the SSO service forwarding the value for ssoIdentifier.

import { Login as SSOLogin } from '@boxyhq/react-ui/sso';

const onSSOSubmit = async (ssoIdentifier: string) => {
  // Below calls signIn from next-auth. Replace this with whatever auth lib that you are using.
  await signIn('boxyhq-saml', undefined, { client_id: ssoIdentifier });
};

<SSOLogin
  buttonText={'Login with SSO'}
  onSubmit={onSSOSubmit}
  classNames={{
    container: 'mt-2',
    label: 'text-gray-400',
    button: 'btn-primary btn-block btn rounded-md active:-scale-95',
    input: 'input-bordered input mb-5 mt-2 w-full rounded-md',
  }}
/>;

Styling

If the classNames prop is passed in, we can override the default styling for each inner element. In case an inner element is omitted from the classNames prop, default styles will be set for the element. For example, In the below snippet, all the inner elements are styled by passing in the classNames for each inner one.

<SSOLogin
  buttonText={'Login with SSO'}
  onSubmit={onSSOSubmit}
  classNames={{
    container: 'mt-2',
    label: 'text-gray-400',
    button: 'btn-primary btn-block btn rounded-md active:-scale-95',
    input: 'input-bordered input mb-5 mt-2 w-full rounded-md',
  }}
/>

Styling via style attribute is also supported for each inner element.

3.3.43

28 days ago

3.3.42

2 months ago

3.3.41

2 months ago

3.3.40

2 months ago

3.3.39

2 months ago

3.3.38

3 months ago

3.3.37

3 months ago

3.3.36

3 months ago

3.3.35

3 months ago

3.3.34

3 months ago

3.3.33

4 months ago

3.3.32

4 months ago

3.3.30

4 months ago

3.3.31

4 months ago

3.3.29

4 months ago

3.3.28

4 months ago

3.3.26

4 months ago

3.3.27

4 months ago

3.3.24

5 months ago

3.3.25

5 months ago

3.3.23

5 months ago

3.3.22

6 months ago

3.3.20

6 months ago

3.3.21

6 months ago

3.3.9

9 months ago

3.3.8

9 months ago

3.3.7

9 months ago

3.3.6

9 months ago

3.2.2

10 months ago

3.2.1

10 months ago

3.2.0

10 months ago

3.2.3

10 months ago

3.3.13

7 months ago

3.3.14

7 months ago

3.3.15

7 months ago

3.3.16

7 months ago

3.3.17

6 months ago

3.3.18

6 months ago

3.3.19

6 months ago

3.3.10

9 months ago

3.3.11

8 months ago

3.3.12

8 months ago

3.1.1

10 months ago

3.1.0

10 months ago

3.3.5

10 months ago

3.3.4

10 months ago

3.3.3

10 months ago

3.0.0

11 months ago

3.0.0-beta.45

12 months ago

3.0.0-beta.47

12 months ago

2.0.0

12 months ago

1.9.9

12 months ago

1.9.8

12 months ago

1.9.7

1 year ago

1.9.6

1 year ago

1.9.1

1 year ago

1.8.2

1 year ago

1.9.0

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.9.5

1 year ago

1.7.6

1 year ago

1.9.3

1 year ago

1.9.2

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

1.7.3

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

1.7.5

1 year ago

1.7.4

1 year ago

0.0.26

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago