Skip to main content

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.
linkapp.config.ts
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:
app/expanded.tsx
type Settings = { username: string };

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

Quick Reference

Element TypeDescriptionUse CaseDetails
textSingle-line text inputNames, titles, short text
textareaMulti-line text inputDescriptions, long text
urlURL input with validationWebsite links
passwordPassword/secret inputAPI keys, credentials
numberNumber inputCounts, limits, quantities
selectDropdown menuPredefined choices (3+ options)
radioRadio button groupExclusive choices (2-5 options)
checkboxCheckbox inputMultiple selections, acceptance
switchBoolean toggleEnable/disable features
linkBehaviorLinktree link behaviorEmbed vs. direct link
arrayDynamic list of itemsCollections, lists
integrationThird-party integrationEmail marketing, etc.
embedOptionEmbed display configurationEmbed rendering options
fileFile uploadImages, documents
buttonAction buttonTrigger actions

Common Properties

All element types share these base properties:
PropertyTypeRequiredDescription
idstringYesUnique identifier (becomes prop name)
inputTypestringYesElement type from the table above
titlestringNoField title displayed above input
descriptionstringNoHelp text explaining the field
defaultValueanyNoInitial value (type depends on inputType)
validationobjectNoValidation rules (required, min, max, etc.)
conditionalDisplayobjectNoShow/hide based on other elements

Example

{
  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.

Selection Controls

Dropdowns, radio buttons, and checkboxes for choosing options.

Toggles & Switches

Boolean controls for on/off states.

Advanced Elements

Complex inputs for lists, integrations, and conditional logic.

Validation

Add validation rules to ensure correct input:
{
  id: "email",
  inputType: "text",
  validation: {
    required: true,              // Must not be empty
    pattern: "^[^@]+@[^@]+$",   // Must match regex
    minLength: 5,                // Minimum characters
    maxLength: 100               // Maximum characters
  }
}
Common validation rules:
RuleApplies ToDescription
requiredAll typesField must not be empty
minLengthText, textarea, urlMinimum character count
maxLengthText, textarea, urlMaximum character count
patternText, urlRegular expression match
minNumberMinimum value
maxNumberMaximum value
maxSizeArrayMaximum array items

Validation Examples

See validation examples for each element type

Type Safety

Define settings types for full TypeScript support:
// 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>
}
TypeScript will autocomplete prop names and catch type errors during development!

Best Practices

Use Descriptive IDs

// ✅ Good - clear, descriptive
{
  id: "showTitle";
}
{
  id: "backgroundColor";
}

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

Provide Default Values

{
  id: "itemCount",
  defaultValue: 10  // Sensible default
}

Add Help Text

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

Choose Appropriate Types

// ✅ 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:
linkapp.config.ts
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

Next Steps