BigDesign plays a pivotal part in the BigCommerce control panel and ecosystem. App developers are encouraged to use BigDesign to develop apps that have a native BigCommerce look and feel.
This step focuses on expanding functionality and integrating advanced design elements available as part of the BigDesign library.
From the pages/api folder, open the products folder.
In the products folder, create a list.ts file. The list.ts file will be routed to /api/list and treated as an API endpoint, instead of a regular component.
At the top of the file, import the following packages:
In the lib folder, open the hooks.ts file.
Add the isLoading property to the useProducts custom hook.
useProductList custom hook. You can view hooks.ts (GitHub).In the pages folder, create a products folder.
In the products folder, create an index.tsx file.
At the top of the file, import the following packages:
Because BigDesign and Next.js both have a component called Link, you need to import BigDesign’s Link as StyledLink to avoid TypeScript errors.
Products functional component. The Products component uses the BigDesign’s StatefulTable, a wrapper of the Table component that supports pagination, row selection, and sorting. You can view index.tsx (GitHub).In the components folder, create an innerHeader.tsx file.
At the top of the file, import the following packages:
InnerHeader functional component. You use it for the Product Edit page, a subpage of products (/products/[pid]), whereas the main Header component is used for the main pages such as / and /products. You can view innerHeader.tsx (GitHub).The InnerHeader component uses BigDesign’s Button component with the variant property set to subtle. By setting the variant type to subtle, you remove the button’s border and simultaneously add a hover effect. To learn more about the BigDesign’s Button component, see Buttons Design Guidelines.
The ArrowBackIcon component is part of the BigDesign’s Icons package. You can modify the look of the icon by setting its color and size. To learn more about BigDesign’s Icons, see Icons.
In this step, you incorporate the BigDesign’s Tabs component into your app. You use the Tabs component to organize and navigate between content types. To learn more, see Tabs Developer Docs.
header.tsx file and update the imports.TabIds, TabRoutes, InnerRoutes, and HeaderTypes variables.Header functional component. You can view header.tsx (GitHub).The Header functional component uses the useEffect React hook to perform side effects and enhance performance. Notably, performance enhancement is only visible in a production or production-like environment (integration or staging). router.prefetch() does not prefetch the products page while in the development mode.
Your app should now display two tabs: Home and Products. Click on the Products tab. You should see a list of products from your test store.

When loading the products page for the first time, the latency you notice only happens in the development mode. In production or a production-like environment, router.prefetch() prefetches the products page reducing the latency.
To test your app in a production or a production-like environment (integration or staging), run npm run build instead of npm run dev in your terminal. This builds and compiles your local code. Then, run npm run start to get the performance enhancements traditionally not available in the development mode.
Keep in mind that any changes you make to your code after running npm run build need to go through the build process to be captured.
To surface error messages to the app’s users, add an error message component. You can call this component from any page or component.
In the components folder, add the error.tsx file.
Copy and paste the following code to create the ErrorMessage component. You can view error.tsx (GitHub).
The Loading component makes use of the BigDesign’s indeterminant ProgressCircle indicator. The indeterminant ProgressCircle represents an unknown amount of time for a task to complete. To learn more about BigDesign’s progress indicators, see Progress Circle Developer Docs.
In the components folder, create a loading.tsx file. You can view loading.tsx (GitHub).
Now that you have created the ErrorMessage and Loading components, you can add them to the Products component.
In the /pages/products folder, open the index.tsx file.
Import the ErrorMessage and Loading components.
Products functional component, above the return statement, add the logic to return ErrorMessage and Loading components. isLoading checks when the page or component is loading and isError checks for API errors. You can view index.tsx (GitHub).In the types folder, open the data.ts file.
Export FormData and StringKeyValue TypeScript definitions. You can view data.ts (GitHub).
You use the BigDesign’s Form component to display and edit individual product information.
The BigDesign’s Form component comes with built-in support for accessibility, validation, and handling errors. It supports various input types, including Input, Checkbox, Radio, Select, and Textarea. To learn more, see Form Developer Docs.
In the components folder, add the form.tsx file.
At the top of the file, import the following packages:
FormProps TypeScript definition.FormErrors variable.Form functional component. You can view form.tsx (GitHub).Next.js allows you to create dynamic routes by adding brackets to a page; for example, [pid]. Any route similar to products/123 or products/abc is matched by pages/products/[pid].tsx. To learn more about defining dynamic routes in Next.js, see Dynamic Routes.
Navigate to the /pages/products folder and create a [pid].tsx file.
At the top of the file, import the following packages:
ProductInfo functional component. You can view [pid].tsx (GitHub).The ProductInfo functional component uses the Form component defined in /components/form. When you click on a product from the products list, it takes you to the corresponding page containing information about that particular product.
Because you fetch all product data with the initial Catalog API call, you do not need to make additional calls to retrieve individual product data.
The following image illustrates the Form input types:

Navigate to the /pages/api/products folder.
In the products folder, create a [pid].ts file.
At the top of the file, import the following packages:
PUT request. You can view [pid].ts (GitHub).Pick a product from the products list and try changing its information such as name or price.
Save your changes. The changes should appear on the Products page.
In the pages folder, open the index.tsx file.
Update the imported packages.
border, borderRadius, marginRight, and padding attributes. Replace the Text component with H4 and H1 components. To learn more about BigDesign’s typographic palette, see Typography. You can view index.tsx (GitHub).Your home page should now look similar to the following:

To compile all of the production code for this project and start the app in the production environment, run the following commands in your terminal:
You should now have a fully functional app that pulls data from BigCommerce’s Catalog API and allows you to update each product individually, all in one convenient location.
Home page view

Products page view

Individual product page view

This concludes our Next.js Sample App tutorial. To continue developing with BigCommerce, consider working through these supplemental materials: