> For the complete documentation index, see [llms.txt](https://docs.limio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.limio.com/developers/custom-components/custom-subcomponents.md).

# Custom Subcomponents

How to customise your checkout further

From Release 102, it is now possible to create custom subcomponents. A subcomponent is one that is intended to be used as part of the [Limio Form component](https://docs.limio.com/components/component-library/modular-checkout-components/component-checkout-form). This enables new workflows and means even more customisation is possible when developing a checkout flow.

Whether it's inserting custom fields to collect user information, displaying information, or validating an input via an [External Service](https://docs.limio.com/developers/custom-components/connecting-to-external-service.md) or the [Limio SDK](https://docs.limio.com/developers/limio-sdk/getting-started.md), it is now possible to deliver that easily with just one small change.

In order to add a custom subcomponent, in your `package.json` file, simply add the isCustomSubcomponent: true flag.

```
{
  "name": "headings",
  "version": "1.0.0",
  "description": "A custom subcomponent",
  "main": "./index.js",
  "isCustomSubcomponent": true,
  "author": "",
  "dependencies": {
    ...
  },
  "limioProps": [
    ...
  ]
}
```

Once your changes have been pushed and the component has been built, you should then be able to see your new custom subcomponent when managing a Form component on a page.

## How a custom subcomponent works in the Checkout Form

The Checkout Form renders each subcomponent, standard or custom, inside one HTML `form` element. It renders them in the order that you set in **Edit Subcomponents**. This gives a custom subcomponent the limits that follow.

| Topic        | Behaviour                                                                                                                                                                                                                                                                                                                                                        |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Fields       | An input with a `name` in your subcomponent is part of the Checkout Form. When the customer submits the form, Limio writes the value into the order at the path that the name gives, for example `customFields.myField`.                                                                                                                                         |
| Nested forms | Do not render a `form` element in a custom subcomponent. HTML does not permit a `form` element inside a `form` element.                                                                                                                                                                                                                                          |
| Submit       | A `button` with `type="submit"` in your subcomponent submits the Checkout Form. The form does its validation first, in the same way as for the standard submit button. The standard submit button stays on the page. See [Submit button](https://docs.limio.com/components/component-library/modular-checkout-components/component-checkout-form#submit-button). |
| Conditions   | Conditions show or hide a custom subcomponent in the same way as a standard subcomponent. See [Managing Conditionality in Subcomponents](https://docs.limio.com/components/component-library/modular-checkout-components/managing-conditionality-in-subcomponents).                                                                                              |
| Shared code  | A custom subcomponent is a React component, so it can import and render other React components. Put code that more than one component uses in the `source` folder next to your component folders. Limio does not build `source` as a component.                                                                                                                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.limio.com/developers/custom-components/custom-subcomponents.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
