https://github.com/azizbecha/react-native-multistep
React Native multistep forms made easy ๐
https://github.com/azizbecha/react-native-multistep
forms npm react-native
Last synced: 2 months ago
JSON representation
React Native multistep forms made easy ๐
- Host: GitHub
- URL: https://github.com/azizbecha/react-native-multistep
- Owner: azizbecha
- License: mit
- Created: 2024-11-24T22:18:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-18T18:00:51.000Z (over 1 year ago)
- Last Synced: 2025-10-04T22:50:38.914Z (9 months ago)
- Topics: forms, npm, react-native
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/react-native-multistep
- Size: 1.34 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# React Native MultiStep ๐
A flexible and animated **multi-step form component** for React Native, allowing you to easily create forms with multiple steps. ๐ The component provides **step indicators**, **transition animations**, and **customizable buttons**. ๐จ
## ๐ Features โจ
- โ
**Step Indicator**: Displays a dynamic indicator to show the current step and progress. ๐
- โ
**Animations**: Includes an animated scale effect on the active step indicator. ๐
- โ
**Customizable Buttons**: Custom labels and styles for the back, next, and done buttons. ๐
- โ
**Customizable Styles**: Easily customize every part of the form, including **content container**, **step indicators**, **buttons**, etc. ๐จ
## ๐ง Installation ๐ฆ
1. Install the necessary dependencies:
```bash
npm install react-native-multistep
```
or
```bash
yarn add react-native-multistep
```
2. Import the `MultiStepForm` component into your app: ๐
```tsx
import { MultiStepForm } from 'react-native-multistep';
```
## โ๏ธ Props
| Prop | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `stepsContent` (required) | `React.ReactNode[]` | - | An array of React nodes, where each node represents the content for each step. ๐๏ธ |
| `onStepChange` (optional) | `(currentStep: number) => void` | - | A callback triggered whenever the step changes. ๐ |
| `onStepForward` (optional) | `(currentStep: number) => void` | - | A callback triggered when navigating to the **next step**. โญ๏ธ |
| `onStepBackward` (optional) | `(currentStep: number) => void` | - | A callback triggered when navigating to the **previous step**. ๐ |
| `backButtonLabel` (optional) | `string` | `Back` | Label for the **Back button** ๐ |
| `nextButtonLabel` (optional) | `string` | `Next` | Label for the **Next button** โถ๏ธ |
| `doneButtonLabel` (optional) | `string` | `Done` | Label for the **Done button** โ
|
| `onComplete` (optional) | `() => void` | - | A callback triggered when the form is **completed**. ๐ |
| `style` (optional) | `StyleProp` | - | Custom style for the **root container**. ๐๏ธ |
| `nextButtonStyle` (optional) | `StyleProp` | - | Custom style for the **Next button** ๐น |
| `previousButtonStyle` (optional) | `StyleProp` | - | Custom style for the **Previous button** ๐ |
| `doneButtonStyle` (optional) | `StyleProp` | - | Custom style for the **Done button** โ
|
| `stepsContainerStyle` (optional) | `StyleProp` | - | Custom style for the **step indicators container** ๐ข |
| `activeStepStyle` (optional) | `StyleProp` | - | Custom style for **active step indicators** ๐ฅ |
| `inactiveStepStyle` (optional) | `StyleProp` | - | Custom style for **inactive step indicators** โ๏ธ |
| `contentContainerStyle` (optional) | `StyleProp` | - | Custom style for the **content container** ๐ |
| `buttonsContainerStyle` (optional) | `StyleProp` | - | Custom style for the **footer buttons container** โ๏ธ |
| `lineColor` (optional) | `string` | - | Custom color for the **line between indicators** โ
|
| `activeLineColor` (optional) | `string` | - | Custom color for the **active line between indicators** โ
|
## ๐ Usage Example ๐งต
```tsx
import React from 'react';
import { MultiStepForm } from 'react-native-multistep';
import { Text, View } from 'react-native';
const App = () => {
const stepsContent = [
Step 1: Personal Information ๐ค,
Step 2: Address ๐,
Step 3: Review โ
,
];
const handleStepChange = (currentStep: number) => {
console.log(`Current Step: ${currentStep}`);
};
const handleComplete = () => {
console.log('Form Completed! ๐');
};
return (
);
};
export default App;
```
## ๐จ Styling
The component uses `StyleSheet.create` for default styles. Customize your form by passing the relevant props:
- **Root Container**: `style` ๐๏ธ
- **Step Indicator Container**: `stepsContainerStyle` ๐ข
- **Active/Inactive Step Indicators**: `activeStepStyle`, `inactiveStepStyle` ๐ฅ
- **Content Area**: `contentContainerStyle` ๐
- **Footer Buttons Container**: `buttonsContainerStyle` โ๏ธ
- **Back Button**: `previousButtonStyle` ๐
- **Next Button**: `nextButtonStyle` โถ๏ธ
- **Done Button**: `doneButtonStyle` โ
## ๐ Animations
- **Step Indicator Animation** ๐ฅ: The active step indicator includes a **scale effect** when selected, providing a quick visual cue to the user. ๐
## ๐ค Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the project. ๐ ๏ธ
## ๐ License
MIT ๐
---
Made with โค๏ธ by [Aziz Becha](https://azizbecha.com) ๐