Authors:
Cameron Johns, Cille Schliebitz, Anita Gu
Changed on:
3 Feb 2025
This lesson details how to enhance custom form fields by adding structure, styling, and interactive controls. We'll focus on improving the user experience and data capture capabilities of our custom field component. This involves using Material-UI for styling, organizing the field's layout, and integrating pre-built form controls from the component library, such as the
`QuantitySelector`
`useEffect`
`useEffect`
`useEffect`
Now that you've created your custom field, it's time to give it some structure and style and add in the form controls for our complex payload object.
To achieve this, you will need to perform the following steps:
Let's begin by adding some structure to your custom field:
Next, add some styles:
1const useStyles = makeStyles((theme) => ({
2 locationWrapper: {
3 display: 'flex',
4 flexDirection: 'column',
5 },
6 radioWrapper: {
7 marginRight: 0,
8 '&:hover': {
9 color: theme.palette.primary.main,
10 },
11 },
12 locationLabelWrapper: {
13 width: '100%',
14 },
15 splitColumns: {
16 display: 'flex',
17 flexDirection: 'row',
18 justifyContent: 'space-between',
19 },
20 availableQty: {
21 color: '#94d096',
22 fontWeight: 'bold',
23 },
24 quantitySelectorContainer: {
25 marginBottom: '20px',
26 },
27 quantityLabel: {
28 marginBottom: '10px',
29 color: '#909090',
30 },
31 }));
Language: plain_text
Name: Custom Styles using Material-UI
Description:
This code snippet defines styles for a custom form field component using Material-UI's
`makeStyles`
Finally, let's build the field with some form controls — Refer to the video below to complete this step:
`quantity`
`StockReservationPayload`
`quantity`
`QuantitySelector`
`FieldRegistry`
`QuantitySelector`
`div`
`quantitySelectorContainer`
`name`
`label`
`value`
`onChange`
`useEffect`
This video explains how to retrieve and use existing field components from the registry
Copyright © 2025 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.