# @rathpc/zendesk-react

> A minimal component based implementation to include Zendesk in your React application

Latest version **0.4.15** (published 2024-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rathpc/zendesk-react
pnpm add @rathpc/zendesk-react
yarn add @rathpc/zendesk-react
bun add @rathpc/zendesk-react
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.15 |
| Published | 2024-07-29 |
| First published | 2021-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 2 |
| Unpacked size | 65.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Steven Rathbauer |
| Maintainers | rathpc |
| Keywords | react, zendesk, hooks, wrapper, component |

## Links

- npm: https://www.npmjs.com/package/@rathpc/zendesk-react
- Repository: https://github.com/rathpc/zendesk-react
- Homepage: https://github.com/rathpc/zendesk-react#readme
- Issues: https://github.com/rathpc/zendesk-react/issues
- npm.io page: https://npm.io/package/@rathpc/zendesk-react

## Dependencies (2)

- [react](https://npm.io/package/react.md) >=18.0.0
- [react-dom](https://npm.io/package/react-dom.md) >=18.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.4.15 (latest) — 2024-07-29
- 0.4.14 — 2024-07-29
- 0.4.13 — 2024-07-29
- 0.4.2 — 2023-05-01
- 0.3.0 — 2023-04-12
- 0.2.8 — 2023-04-12
- 0.2.7 — 2023-04-12
- 0.2.6 — 2023-04-12
- 0.2.5 — 2023-04-12
- 0.2.4 — 2022-11-13
- 0.2.3 — 2022-07-20
- 0.2.2 — 2022-03-31
- 0.2.1 — 2022-01-18
- 0.1.0 — 2021-07-12

## README

# zendesk-react

> A minimal component based implementation to include Zendesk in your React application

## Introduction

This component allows you to integrate the Zendesk Web Widget easily into an existing React application by the use of a
component. For official Zendesk information on how to configure the widget and use the api, please refer to the
[Zendesk official documentation](https://developer.zendesk.com/embeddables/docs/widget/introduction).

<br />

## Installation

```sh
npm i @rathpc/zendesk-react --save
```

or

```sh
yarn add @rathpc/zendesk-react
```

<br />

## Usage

### Component usage

```tsx
...

import { Zendesk } from '@rathpc/zendesk-react';

...

const zendeskKey = 'your-unique-zendesk-key';

// Settings to pass into the component - we are positioning the widget and hiding the contact form
const zendeskSettings = {
  contactForm: {
    suppress: true,
  },
  position: {
    horizontal: 'left',
    vertical: 'bottom',
  },
};

export const SomeOtherComponent: React.FC = () => {
  // Optionally perform some actions after the Zendesk script has been loaded
  const initCallback = () => {
    console.log('Script loaded and ready!');
  };

  return (
    <div>
      ...
      <Zendesk zendeskKey={zendeskKey} zendeskSettings={zendeskSettings} initCallback={initCallback} defer />
      ...
    </div>
  );
};
```

#### Component Attributes

|Attribute       |Required (*) |Type                    |Default Value |Description                                                                                                                         |
|:---------------|:-----------:|:-----------------------|:-------------|:-----------------------------------------------------------------------------------------------------------------------------------|
|defer           |             |boolean                 |undefined     |Set this to true if you want the script tag to use defer instead of async                                                           |
|disabled        |             |boolean                 |undefined     |Set this to true if you do not want the component to add the script to the document. This may be useful in development environments |
|initCallback    |             |() => void              |undefined     |Define a function to be called upon a successful loading of the Zendesk script                                                      |
|zendeskKey      |*            |string                  |              |The unique key you are provided from Zendesk                                                                                        |
|zendeskSettings |             |Record<string, unknown> |undefined     |An object to pass to the Zendesk widget instance on initialization for configuration of the widget                                  |

<br />

### API usage

```ts
import { zendeskAPI } from '@rathpc/zendesk-react';

// Programatically hide the widget
zendeskApi('webWidget', 'hide')

```

<br />

## License

MIT

<br />
<br />
<br />

## Special Thanks

> Inspiration to make this library derived from <https://github.com/B3nnyL/react-zendesk>

---
_Source: https://npm.io/package/@rathpc/zendesk-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
