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

# Settings Element Reference

> Complete reference for all LinkApp settings element types

## Overview

Settings elements define the form fields shown to users when they configure your LinkApp. Each element type provides different input options—from simple text boxes to complex arrays.

```ts linkapp.config.ts theme={"system"}
export default {
  settings: {
    elements: [
      {
        id: "username", // Becomes prop name
        inputType: "text", // Element type
        title: "Username", // Field title
        defaultValue: "", // Initial value
      },
    ],
  },
};
```

The `id` property becomes a prop in your layout component:

```tsx app/expanded.tsx theme={"system"}
type Settings = { username: string };

export default function ClassicLayout({ username }: AppProps<Settings>) {
  return <div>Hello, {username}!</div>;
}
```

## Quick Reference

| Element Type | Description | Use Case | Details |
| - | - | - | - |
| `text` | Single-line text input | Names, titles, short text | [→](https://docs.linktr.ee/essentials/settings/text-inputs.md#text) |
| `textarea` | Multi-line text input | Descriptions, long text | [→](https://docs.linktr.ee/essentials/settings/text-inputs.md#textarea) |
| `url` | URL input with validation | Website links | [→](https://docs.linktr.ee/essentials/settings/text-inputs.md#url) |
| `number` | Number input | Counts, limits, quantities | [→](https://docs.linktr.ee/essentials/settings/text-inputs.md#number) |
| `select` | Dropdown menu | Predefined choices (3+ options) | [→](https://docs.linktr.ee/essentials/settings/selections.md#select) |
| `radio` | Radio button group | Exclusive choices (2-5 options) | [→](https://docs.linktr.ee/essentials/settings/selections.md#radio) |
| `checkbox` | Checkbox input | Multiple selections, acceptance | [→](https://docs.linktr.ee/essentials/settings/selections.md#checkbox) |
| `switch` | Boolean toggle | Enable/disable features | [→](https://docs.linktr.ee/essentials/settings/toggles.md#switch) |
| `linkBehavior` | Linktree link behavior | Embed vs. direct link | [→](https://docs.linktr.ee/essentials/settings/toggles.md#link-behavior) |
| `location` | Google Places picker | Addresses, venues, stores | [→](https://docs.linktr.ee/essentials/settings/location.md) |
| `array` | Dynamic list of items | Collections, lists | [→](https://docs.linktr.ee/essentials/settings/advanced.md#array) |
| `integration` | Third-party integration | Email marketing, etc. | [→](https://docs.linktr.ee/essentials/settings/advanced.md#integration) |
| `file` | File upload | Images, documents | [→](https://docs.linktr.ee/essentials/settings/advanced.md#file-upload) |
| `button` | Action button | Trigger actions | [→](https://docs.linktr.ee/essentials/settings/advanced.md#button) |

## Common Properties

All element types share these base properties:

| Property | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Unique identifier (becomes prop name) |
| `inputType` | `string` | Yes | Element type from the table above |
| `title` | `string` | No | Field title displayed above input |
| `description` | `string` | No | Help text explaining the field |
| `defaultValue` | `any` | No | Initial value (type depends on inputType) |
| `validation` | `object` | No | Validation rules (required, min, max, etc.) |
| `conditionalDisplay` | `object` | No | Show/hide based on other elements |

### Example

```ts theme={"system"}
{
  id: "apiKey",
  inputType: "text",
  title: "API Key",
  description: "Get your API key from example.com/settings",
  placeholder: "Enter your API key",
  defaultValue: "",
  validation: {
    required: true,
    minLength: 20
  }
}
```

## Element Categories

### Text Inputs

Simple and multi-line text entry fields.

> [card] [Text & Textarea](https://docs.linktr.ee/essentials/settings/text-inputs.md#text)
>
> Single-line and multi-line text inputs

> [card] [URL Input](https://docs.linktr.ee/essentials/settings/text-inputs.md#url)
>
> Validated URL inputs for website links

> [card] [Number Input](https://docs.linktr.ee/essentials/settings/text-inputs.md#number)
>
> Numeric values with min/max validation

> [card] [View All Text Inputs →](https://docs.linktr.ee/essentials/settings/text-inputs.md)
>
> See detailed documentation

### Selection Controls

Dropdowns, radio buttons, and checkboxes for choosing options.

> [card] [Select Dropdown](https://docs.linktr.ee/essentials/settings/selections.md#select)
>
> Choose one from many options

> [card] [Radio Buttons](https://docs.linktr.ee/essentials/settings/selections.md#radio)
>
> Visual option selection (2-5 choices)

> [card] [Checkboxes](https://docs.linktr.ee/essentials/settings/selections.md#checkbox)
>
> Single or multiple selections

> [card] [View All Selection Controls →](https://docs.linktr.ee/essentials/settings/selections.md)
>
> See detailed documentation

### Toggles & Switches

Boolean controls for on/off states.

> [card] [Switch Toggle](https://docs.linktr.ee/essentials/settings/toggles.md#switch)
>
> Enable/disable features

> [card] [Link Behavior](https://docs.linktr.ee/essentials/settings/toggles.md#link-behavior)
>
> Control how links open (Linktree-specific)

> [card] [View All Toggles →](https://docs.linktr.ee/essentials/settings/toggles.md)
>
> See detailed documentation

### Advanced Elements

Complex inputs for lists, integrations, and conditional logic.

> [card] [Array Lists](https://docs.linktr.ee/essentials/settings/advanced.md#array)
>
> Dynamic lists of structured items

> [card] [Integrations](https://docs.linktr.ee/essentials/settings/advanced.md#integration)
>
> Connect third-party services

> [card] [Conditional Display](https://docs.linktr.ee/essentials/settings/advanced.md#conditional-display)
>
> Show/hide elements based on values

> [card] [View All Advanced Elements →](https://docs.linktr.ee/essentials/settings/advanced.md)
>
> See detailed documentation

## Validation

Add validation rules to ensure correct input:

```ts theme={"system"}
{
  id: "email",
  inputType: "text",
  validation: {
    required: true,              // Must not be empty
    pattern: "^[^@]+@[^@]+$",   // Must match regex
    minLength: 5,                // Minimum characters
    maxLength: 100               // Maximum characters (shows real-time counter)
  }
}
```

### Validation Rules Reference

| Rule | Applies To | Description |
| - | - | - |
| `required` | All types | Field must not be empty |
| `minLength` | Text, textarea, url | Minimum character count |
| `maxLength` | Text, textarea, url | Maximum character count (enables char counter) |
| `pattern` | Text, url | Regular expression match |
| `min` | Number | Minimum numeric value |
| `max` | Number | Maximum numeric value |
| `minItems` | Array | Minimum number of array items |
| `maxItems` | Array | Maximum number of array items |
| `maxFileSize` | File | Maximum file size in bytes |

> [!NOTE]
>
> **Character Counter:** When you set `maxLength` on a text field, the Linktree
> editor automatically shows a real-time character counter (e.g., "45/100 characters")
> as users type.

### Array Validation Example

```ts theme={"system"}
{
  id: "testimonials",
  inputType: "array",
  validation: {
    minItems: 1,    // At least 1 item required
    maxItems: 10    // Maximum 10 items allowed
  },
  array_options: {
    add_item_button_text: "Add testimonial",
    item_format: "{{name}} - {{title}}"
  },
  array_elements: [
    { id: "name", inputType: "text", title: "Name" },
    { id: "title", inputType: "text", title: "Title" }
  ]
}
```

### File Validation Example

```ts theme={"system"}
{
  id: "coverImage",
  inputType: "file",
  title: "Cover Image",
  accept: ["image/jpeg", "image/png"],
  validation: {
    required: true,
    maxFileSize: 5242880  // 5MB in bytes
  }
}
```

> [card] [Validation Examples](https://docs.linktr.ee/essentials/settings/advanced.md#validation)
>
> See validation examples for each element type

## Type Safety

Define settings types for full TypeScript support:

```ts theme={"system"}
// Define settings type matching your config
type MyLinkAppSettings = {
  showTitle: boolean      // switch element
  username: string        // text element
  theme: 'light' | 'dark' // select element
  itemCount: number       // number element
}

// Use in layout with full type safety
export default function ClassicLayout({
  showTitle,
  username,
  theme,
  itemCount
}: AppProps<MyLinkAppSettings>) {
  // TypeScript knows all prop types ✨
  return <div>...</div>
}
```

> [!TIP]
>
> TypeScript will autocomplete prop names and catch type errors during
> development!

## Best Practices

### Use Descriptive IDs

```ts theme={"system"}
// ✅ Good - clear, descriptive
{
  id: "showTitle";
}
{
  id: "backgroundColor";
}

// ❌ Avoid - abbreviations, unclear
{
  id: "st";
}
{
  id: "bgClr";
}
```

### Provide Default Values

```ts theme={"system"}
{
  id: "itemCount",
  defaultValue: 10  // Sensible default
}
```

### Add Help Text

```ts theme={"system"}
{
  id: "apiKey",
  description: "Get your API key from https://example.com/settings/api"
}
```

### Choose Appropriate Types

```ts theme={"system"}
// ✅ Good - validates URL format
{ id: "website", inputType: "url" }

// ❌ Less good - allows any text
{ id: "website", inputType: "text" }
```

## Complete Example

Here's a real-world example for a weather LinkApp:

```ts linkapp.config.ts theme={"system"}
export default {
  settings: {
    title: "Weather",
    elements: [
      {
        id: "location",
        inputType: "text",
        title: "Location",
        description: "City name for weather data",
        label: "City",
        defaultValue: "San Francisco",
        validation: { required: true },
      },
      {
        id: "units",
        inputType: "select",
        title: "Temperature Units",
        label: "Units",
        defaultValue: "celsius",
        options: [
          { label: "Celsius (°C)", value: "celsius" },
          { label: "Fahrenheit (°F)", value: "fahrenheit" },
        ],
      },
      {
        id: "showForecast",
        inputType: "switch",
        title: "Display Options",
        label: "Show 5-day forecast",
        defaultValue: true,
      },
    ],
  },
};
```

## Explore Element Types

> [card] [Text Inputs](https://docs.linktr.ee/essentials/settings/text-inputs.md)
>
> Text, textarea, URL, and number inputs

> [card] [Selection Controls](https://docs.linktr.ee/essentials/settings/selections.md)
>
> Select, radio, and checkbox elements

> [card] [Toggles](https://docs.linktr.ee/essentials/settings/toggles.md)
>
> Switch and link behavior elements

> [card] [Advanced Elements](https://docs.linktr.ee/essentials/settings/advanced.md)
>
> Arrays, integrations, and conditional display

## Next Steps

> [card] [Configuration](https://docs.linktr.ee/essentials/configuration/settings.md)
>
> Learn about settings structure

> [card] [Layouts](https://docs.linktr.ee/essentials/layouts.md)
>
> Use settings in your layouts

> [card] [Examples](https://docs.linktr.ee/essentials/settings/advanced.md#complete-examples)
>
> See real-world examples


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.