> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Format to URL encoded

> Converts a data object or array into a URL encoded string.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Takes a single piece of text and makes it safe to drop into a web address by encoding any characters that are not allowed there. Spaces become `+`, and characters such as `&`, `?`, and `/` are replaced with their percent-encoded form. Use this when you need to put a value into a URL or a query string, for example a search term or a parameter, without it breaking the address. There is nothing to configure; point it at the text you want to encode.

This documentation describes: [Schema](/schemas/mapper/serialize-url-encode)

## Sample data

This example encodes one piece of text. The spaces become `+` and the ampersand becomes `%26`.

Input:

```json theme={null}
{
    "text": "Wool scarf & leather belt"
}
```

Output:

```json theme={null}
{
    "text": "Wool+scarf+%26+leather+belt"
}
```

```json Configuration theme={null}
{
  "prototype": "serialize-url-encode",
  "parameters": {}
}
```
