├── .github └── workflows │ └── release.yml ├── .gitignore ├── .npmignore ├── LICENSE.md ├── README.md ├── package-lock.json ├── package.json ├── src ├── index.ts ├── types.ts ├── useForm.ts └── utils.ts └── tsconfig.json /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: 🚀 formbold react release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main # Adjust this to your desired branch 7 | 8 | jobs: 9 | publish: 10 | name: 🚀 formbold react release 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v2 16 | 17 | - name: Setup Node.js 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: 18 21 | registry-url: "https://registry.npmjs.org" 22 | 23 | - name: Clear npm cache 24 | run: npm cache clean --force 25 | - name: Delete node_modules 26 | run: rm -rf node_modules 27 | 28 | - name: Install dependencies 29 | run: npm ci 30 | 31 | - name: Build 32 | run: npm run build # Replace with your build command if needed 33 | 34 | - name: Publish to npm 35 | run: npm publish --access public 36 | env: 37 | NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_FORMBOLDREACT }} 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /dist -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src 3 | 4 | tsconfig.json -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Lineicons 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Formbold-react — The easiest way to configure and use Form in React/Next.js 3 | React package for [FormBold](https://formbold.com/) which simplifies the integration of FormBold with React/Next.js projects. 4 | 5 | FormBold is a multipurpose form API and serverless backend solution compatible with all hosting, SSG, and frameworks. It allows you to receive form submissions directly in your email, slack, telegram, notion, and more. It's ready for use with any Static, Jamstack, and SSG sites, such as HTML, React, Next.js, Gatsby, Vue, Nuxt, Hugo, and Jekyll. 6 | 7 | It offers a wide range of form fields, advanced features like conditional logic, and seamless integration with other tools. 8 | 9 | ## Installation 10 | 11 | ```bash 12 | npm install formbold-react 13 | ``` 14 | 15 | or 16 | 17 | ```bash 18 | yarn add formbold-react 19 | ``` 20 | 21 | ## Usages 22 | 23 | To use it you have to import it in your Form component. Then call it with the form_id. 24 | 25 | And at the end, attach the handleSubmit function to the onSubmit event. 26 | 27 | ```typescript 28 | import { useForm } from "formbold-react"; 29 | 30 | function Form() { 31 | const [state, handleSubmit] = useForm("form_id"); 32 | 33 | if (state.succeeded) { 34 | return
Form submitted successfully
; 35 | } 36 | 37 | return ( 38 | <> 39 |

Home Page

40 |
41 | 42 | 43 |