Overview
The @react-form-builder/components-mantine package provides a comprehensive set of Mantine components for use with FormEngine. Build modern, accessible forms using Mantine's elegant component library with full theming support.
Installation
Install the package along with FormEngine Core and Mantine dependencies:
npm install @react-form-builder/core @react-form-builder/components-mantine
Basic Usage
Here's an example of how to set up FormEngine with Mantine components:
import {view} from '@react-form-builder/components-mantine'
import {buildForm, FormViewer} from '@react-form-builder/core'
import '@mantine/core/styles.css'
import '@mantine/dates/styles.css'
const simpleForm = buildForm()
.component('container', 'MtContainer')
.style({flexDirection: 'row'})
.children((builder) =>
builder
.component('firstName', 'MtTextInput')
.prop('placeholder', 'Enter your first name')
.prop('label', 'First Name')
.validation('required')
.component('lastName', 'MtTextInput')
.prop('placeholder', 'Enter your last name')
.prop('label', 'Last Name')
.validation('required')
)
.component('birthDate', 'MtDatePickerInput')
.prop('label', 'Birth Date')
.validation('min').args({value: '1980-01-07T00:00:00.000Z'})
.component('submit', 'MtButton')
.prop('children', 'Submit')
.event('onClick')
.commonAction('validate').args({failOnError: true})
.customAction('onSubmit')
.json()
export const App = () => {
return <FormViewer
view={view}
getForm={() => simpleForm}
actions={{
onSubmit: (e) => {
// submit the form to the backend
alert('Form data: ' + JSON.stringify(e.data))
},
}}
/>
}
Available Components
Date and Time
MtDateMultiplePickerMtDateMultiplePickerInputMtDatePickerMtDatePickerInputMtDateRangePickerMtDateRangePickerInputMtDateTimePickerMtMonthMultiplePickerMtMonthMultiplePickerInputMtMonthPickerMtMonthPickerInputMtMonthRangePickerMtMonthRangePickerInputMtTimeGridMtTimeInputMtTimePickerMtYearMultiplePickerMtYearMultiplePickerInputMtYearPickerMtYearPickerInputMtYearRangePickerMtYearRangePickerInput
Documentation
For complete documentation and more examples, visit:
Support
Need help getting started? Check out our GitHub repository or contact our team for assistance.
Need help with Mantine integration?
Our team can help you get started with FormEngine and Mantine.