# @gorhom/paper-onboarding

> Paper Onboarding is a material design UI slider for `React Native`.

Latest version **1.2.0** (published 2021-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gorhom/paper-onboarding
pnpm add @gorhom/paper-onboarding
yarn add @gorhom/paper-onboarding
bun add @gorhom/paper-onboarding
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-07-28 |
| First published | 2020-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 286.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 914 |
| Author | Mo Gorhom |
| Maintainers | gorhom |
| Keywords | onboarding, paper, paper onboarding, react-native, ios, android, reanimated |

## Links

- npm: https://www.npmjs.com/package/@gorhom/paper-onboarding
- Repository: https://github.com/gorhom/react-native-paper-onboarding
- Issues: https://github.com/gorhom/react-native-paper-onboarding/issues
- npm.io page: https://npm.io/package/@gorhom/paper-onboarding

## Dependencies (3)

- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.5.0
- [react-native-svg](https://npm.io/package/react-native-svg.md) ^12.1.1
- [react-native-redash](https://npm.io/package/react-native-redash.md) ^14.2.4

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2021-07-28
- 1.1.0 — 2021-06-16
- 1.0.0 — 2020-06-14
- 0.5.0 — 2020-05-13
- 0.4.0 — 2020-04-21
- 0.3.1 — 2020-04-04
- 0.3.0 — 2020-04-03
- 0.2.3 — 2020-03-03
- 0.2.2 — 2020-03-01
- 0.2.1 — 2020-03-01
- 0.2.0 — 2020-03-01

## README

<div align="center">
<h1>Paper Onboarding</h1>

[![npm](https://badgen.net/npm/v/@gorhom/paper-onboarding)](https://www.npmjs.com/package/@gorhom/paper-onboarding) [![npm](https://badgen.net/npm/license/@gorhom/paper-onboarding)](https://www.npmjs.com/package/@gorhom/paper-onboarding) [![npm](https://badgen.net/npm/types/@gorhom/paper-onboarding)](https://www.npmjs.com/package/@gorhom/paper-onboarding)

<img src="./preview.gif">

Paper Onboarding is a material design UI slider for `React Native` inspired by [Ramotion Paper Onboarding](https://github.com/Ramotion/paper-onboarding).

</div>

---

## Installation

```sh
yarn add @gorhom/paper-onboarding
# or
npm install @gorhom/paper-onboarding
```

> Also, you need to install [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated), [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler) & [react-native-svg](https://github.com/react-native-community/react-native-svg), and follow their installation instructions.

## Usage

```tsx
import PaperOnboarding, {PaperOnboardingItemType} from "@gorhom/paper-onboarding";

const data: PaperOnboardingItemType[] = [
  {
    title: 'Hotels',
    description: 'All hotels and hostels are sorted by hospitality rating',
    backgroundColor: '#698FB8',
    image: /* IMAGE COMPONENT */,
    icon: /* ICON COMPONENT */,
    content: /* CUSTOM COMPONENT */,
  },
  {
    title: 'Banks',
    description: 'We carefully verify all banks before add them into the app',
    backgroundColor: '#6CB2B8',
    image: /* IMAGE COMPONENT */,
    icon: /* ICON COMPONENT */,
    content: /* CUSTOM COMPONENT */,
  },
  {
    title: 'Stores',
    description: 'All local stores are categorized for your convenience',
    backgroundColor: '#9D8FBF',
    image: /* IMAGE COMPONENT */,
    icon: /* ICON COMPONENT */,
    content: /* CUSTOM COMPONENT */,
  },
];

const Screen = () => {
  const handleOnClosePress = () => console.log('navigate to other screen')
  return (
    <PaperOnboarding
      data={data}
      onCloseButtonPress={handleOnClosePress}
    />
  )
}
```

## Props

| name                     | description                                                          | required | type                                                       | default                                    |
| ------------------------ | -------------------------------------------------------------------- | -------- | ---------------------------------------------------------- | ------------------------------------------ |
| data                     | Array of pages/slides to present.                                    | YES      | Array<[PaperOnboardingItemType](#paperonboardingitemtype)> |                                            |
| safeInsets               | Safe area insets usually come from `react-native-safe-area-context`. | NO       | Insets                                                     | {top: 50, bottom: 50, left: 50, right: 50} |
| direction                | Pan gesture direction.                                               | NO       | 'horizontal' \| 'vertical'                                 | horizontal                                 |
| indicatorSize            | Indicator size (width and height).                                   | NO       | number                                                     | 40                                         |
| indicatorBackgroundColor | Indicator background color.                                          | NO       | string                                                     | white                                      |
| indicatorBorderColor     | Indicator border color.                                              | NO       | string                                                     | white                                      |
| titleStyle               | Text style to override `all` page/slide title style.                 | NO       | StyleProp<TextStyle>                                       |                                            |
| descriptionStyle         | Text style to override `all` page/slide description style.           | NO       | StyleProp<TextStyle>                                       |                                            |
| closeButton              | Custom component to be used instead of the default close button.     | NO       | (() => React.ReactNode) \| React.ReactNode                 |                                            |
| closeButtonText          | Close button text.                                                   | NO       | string                                                     | close                                      |
| closeButtonTextStyle     | Close button text style.                                             | NO       | StyleProp<TextStyle>                                       |                                            |
| onCloseButtonPress       | Callback on close button pressed.                                    | NO       | () => void                                                 |                                            |
| onIndexChange            | Callback when index change.                                          | NO       | () => void                                                 |                                            |

#### PaperOnboardingItemType

| name             | description                                                                                   | required | type                                                                                    |
| ---------------- | --------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------- |
| content          | Slide/page content, this will replace default content.                                        | NO       | ((props: [PageContentProps](./src/types.ts#L87)) => React.ReactNode) \| React.ReactNode |
| image            | Image cover.                                                                                  | NO       | (() => React.ReactNode) \| React.ReactNode                                              |
| icon             | Indicator icon.                                                                               | NO       | (() => React.ReactNode) \| React.ReactNode                                              |
| backgroundColor  | Background color.                                                                             | YES      | string                                                                                  |
| title            | Title text.                                                                                   | NO       | string                                                                                  |
| description      | Description text.                                                                             | NO       | string                                                                                  |
| titleStyle       | Text style to override page/slide title default style.                                        | NO       | StyleProp<TextStyle>                                                                    |
| descriptionStyle | Text style to override page/slide description default style.                                  | NO       | StyleProp<TextStyle>                                                                    |
| showCloseButton  | Show close button when page/slide is active, _note: last page will always show close button._ | NO       | boolean                                                                                 |

## Methods

| name     | description                | type       |
| -------- | -------------------------- | ---------- |
| next     | Navigate to next page.     | () => void |
| previous | Navigate to previous page. | () => void |

## Built With ❤️

- [react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler)
- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
- [react-native-redash](https://github.com/wcandillon/react-native-redash)
- [react-native-svg](https://github.com/react-native-community/react-native-svg)
- [@react-native-community/bob](https://github.com/react-native-community/bob)

## Author

- [Mo Gorhom](https://twitter.com/gorhom)

## License

MIT

<div align="center">

Liked the library? 😇

<a href="https://www.buymeacoffee.com/gorhom" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" alt="Buy Me A Coffee" height="50" ></a>

</div>

---

<p align="center">
<a href="https://gorhom.dev" target="_blank"><img alt="Mo Gorhom" src="./logo.png"></a>
</p>

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