@viveksinghind/narrative-form-react 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +79 -77
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @viveksinghind/narrative-form-react
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
React integration for Narrative Form, a dynamic typewriter-style sign-up flow.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,30 +8,44 @@ React components for Narrative Form — a beautiful, typewriter-style signup flo
|
|
|
8
8
|
npm install @viveksinghind/narrative-form-react @viveksinghind/narrative-form-core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
- 💅 Beautiful, animated typewriter UI out of the box
|
|
14
|
-
- ⚡️ Built on top of a robust core state machine
|
|
15
|
-
- 🎨 Fully customizable and themeable
|
|
16
|
-
- 📱 Responsive and accessible
|
|
17
|
-
|
|
18
|
-
## Basic Usage
|
|
11
|
+
## Usage
|
|
19
12
|
|
|
20
13
|
```tsx
|
|
14
|
+
import React from 'react';
|
|
21
15
|
import { NarrativeForm } from '@viveksinghind/narrative-form-react';
|
|
22
|
-
import '@viveksinghind/narrative-form-react/dist/index.css';
|
|
23
16
|
|
|
24
|
-
const
|
|
25
|
-
|
|
17
|
+
const myFormConfig = {
|
|
18
|
+
form: { id: "test", name: "Test Form", version: 1 },
|
|
19
|
+
welcome: {
|
|
20
|
+
heading: "Welcome to the future",
|
|
21
|
+
subtext: "Let's get started",
|
|
22
|
+
ctaLabel: "Begin"
|
|
23
|
+
},
|
|
24
|
+
fields: [
|
|
25
|
+
{
|
|
26
|
+
key: "name",
|
|
27
|
+
type: "text",
|
|
28
|
+
prefix: "Hi, my name is",
|
|
29
|
+
validation: { required: true }
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
done: {
|
|
33
|
+
message: "All done! Thank you.",
|
|
34
|
+
}
|
|
26
35
|
};
|
|
27
36
|
|
|
28
|
-
function App() {
|
|
37
|
+
export default function App() {
|
|
29
38
|
return (
|
|
30
|
-
<NarrativeForm
|
|
39
|
+
<NarrativeForm
|
|
40
|
+
config={myFormConfig}
|
|
41
|
+
onComplete={(values) => console.log('Form Complete!', values)}
|
|
42
|
+
/>
|
|
31
43
|
);
|
|
32
44
|
}
|
|
33
45
|
```
|
|
34
46
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
## Features
|
|
48
|
+
- Fully typed React components
|
|
49
|
+
- Smooth CSS animations for the typewriter effect
|
|
50
|
+
- Accessible form elements
|
|
51
|
+
- Themeable via config
|