UNPKG

5.21 kBMarkdownView Raw
1# <a href="https://tripetto.com/"><img src="https://unpkg.com/tripetto/assets/banner.svg" alt="Tripetto"></a>
2
3Tripetto is a full-fledged form kit. Rapidly build and run smart flowing forms and surveys. Drop the kit in your codebase and use all of it or just the parts you need. The visual [**builder**](https://www.npmjs.com/package/tripetto) is for form building, and the [**runners**](https://www.npmjs.com/package/tripetto-runner-foundation) are for running those forms in different UI variants. It is entirely extendible and customizable. Anyone can build their own building [**blocks**](https://docs.tripetto.com/guide/blocks) (e.g., question types) or runner UI's.
4
5# Autoscroll runner
6[![Version](https://img.shields.io/npm/v/tripetto-runner-autoscroll.svg)](https://www.npmjs.com/package/tripetto-runner-autoscroll)
7[![License](https://img.shields.io/npm/l/tripetto-runner-autoscroll.svg)](https://opensource.org/licenses/MIT)
8[![Downloads](https://img.shields.io/npm/dt/tripetto-runner-autoscroll.svg)](https://www.npmjs.com/package/tripetto-runner-autoscroll)
9[![Pipeline status](https://gitlab.com/tripetto/runners/autoscroll/badges/master/pipeline.svg)](https://gitlab.com/tripetto/runners/autoscroll/commits/master)
10[![Follow us on Twitter](https://img.shields.io/twitter/follow/tripetto.svg?style=social&label=Follow)](https://twitter.com/tripetto)
11
12# Purpose
13This package is a UI for running Tripetto forms and surveys that uses a scroll effect (either vertical or horizontal) to display the questions and elements (so called blocks).
14
15[![Try the demo](https://unpkg.com/tripetto/assets/button-demo.svg)](https://tripetto.gitlab.io/runners/autoscroll/)
16
17# Get started
18There are multiple options how you can use this runner. From plain old HTML to [React](https://reactjs.org/) or using imports.
19
20## Option A: Embed in HTML using CDN
21You need to import the [runner foundation](https://www.npmjs.com/package/tripetto-runner-foundation) script and the autoscroll runner script:
22```html
23<script src="https://unpkg.com/tripetto-runner-foundation"></script>
24<script src="https://unpkg.com/tripetto-runner-autoscroll"></script>
25<script>
26TripettoAutoscroll.run({
27 definition: /** Supply a form definition here. */,
28 onSubmit: function(instance) {
29 // Implement your response handler here.
30
31 // For this example we output all exportable fields to the browser console
32 console.dir(TripettoRunner.Export.exportables(instance));
33
34 // Or output the data in CSV-format
35 console.dir(TripettoRunner.Export.CSV(instance));
36 }
37});
38</script>
39```
40
41[![Try demo on CodePen](https://unpkg.com/tripetto/assets/button-codepen.svg)](https://codepen.io/tripetto/pen/KEYrVm)
42
43## Option B: Using React
441. Install the required packages from npm:
45```bash
46$ npm install tripetto-runner-foundation tripetto-runner-autoscroll react react-dom
47```
482. Use the React component:
49```typescript
50import ReactDOM from "react-dom";
51import { AutoscrollRunner } from "tripetto-runner-autoscroll";
52import { Export } from "tripetto-runner-foundation";
53
54ReactDOM.render(
55 <AutoscrollRunner
56 definition={/** Supply a form definition here. */}
57 onSubmit={instance => {
58 // Implement your response handler here.
59
60 // For this example we output all exportable fields to the browser console
61 console.dir(Export.exportables(instance));
62
63 // Or output the data in CSV-format
64 console.dir(Export.CSV(instance));
65 }}
66 />,
67 document.getElementById("your-element")
68);
69```
70
71## Option C: Import from npm
721. Install the required packages from npm:
73```bash
74$ npm install tripetto-runner-foundation tripetto-runner-autoscroll react react-dom
75```
762. Import the runner:
77```typescript
78import { run } from "tripetto-runner-autoscroll";
79import { Export } from "tripetto-runner-foundation";
80
81run({
82 definition: /** Supply a form definition here. */,
83 onSubmit: instance => {
84 // Implement your response handler here.
85
86 // For this example we output all exportable fields to the browser console
87 console.dir(Export.exportables(instance));
88
89 // Or output the data in CSV-format
90 console.dir(Export.CSV(instance));
91 }
92});
93```
94
95# Documentation
96The complete Tripetto documentation can be found at [docs.tripetto.com](https://docs.tripetto.com).
97
98# Support
99Run into issues or bugs? Report them [here](https://gitlab.com/tripetto/runners/autoscroll/issues) and we'll look into them.
100
101For general support contact us at [support@tripetto.com](mailto:support@tripetto.com). We're more than happy to assist you.
102
103# License
104[![License](https://img.shields.io/npm/l/tripetto.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode)
105
106You are allowed to use this package without a license (and free of charge) as long as you keep the Tripetto branding enabled (which is the default mode). When you want to remove the branding, you need a (paid) license to do so.
107
108# Contributors
109- [Hisam Fahri](https://gitlab.com/hisamafahri) (Indonesian translation)
110- [Krzysztof Kamiński](https://gitlab.com/kriskaminski) (Polish translation)
111
112# About us
113If you want to learn more about Tripetto or contribute in any way, visit us at [Tripetto.com](https://tripetto.com/).