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

# TextInput

> Adds a single-line Text Input panel in the Makeswift builder to visually edit a `string` prop.

<Frame type="glass" caption="A Text Input panel for a Button component to change the text">
  <img src="https://mintcdn.com/makeswift/cdz9WIAi676OTSsF/images/text-input-panel.png?fit=max&auto=format&n=cdz9WIAi676OTSsF&q=85&s=021076aeffbb5f0fc3c08288a7521897" width="2048" height="1280" data-path="images/text-input-panel.png" />
</Frame>

## Params

<ParamField query="label" type="string" default="Text">
  Text for the panel label in the Makeswift builder.
</ParamField>

<ParamField query="description" type="string">
  The description shown in the Panel of the Makeswift builder. This can be written in Markdown format.
  Added in [`v0.24.8`](https://github.com/makeswift/makeswift/releases/tag/%40makeswift%2Fruntime%400.24.8).
</ParamField>

<ParamField query="defaultValue" type="string">
  The value passed to your component when nothing is set in the Makeswift
  builder.
</ParamField>

## Prop type

The TextInput control passes a `string` to your component. If you don't set a `defaultValue` and no value is set in the builder, your component receives `undefined`.

## Example

The following example adds a Text Input control to the `children` prop of a Link component.

<CodeGroup>
  ```tsx Button.makeswift.ts theme={null}
  import { TextInput } from "@makeswift/runtime/controls";

  import { runtime } from "@/makeswift/runtime";

  import { Button } from "./Button";

  runtime.registerComponent(Button, {
    type: "button",
    label: "Button",
    props: {
      text: TextInput({ label: "Text", defaultValue: "Click me" }),
    },
  });
  ```

  ```tsx Button.tsx theme={null}
  interface Props {
    text?: string;
  }

  export function Button({ text = "Click me" }: Props) {
    return (
      <button className="px-4 py-3 rounded bg-primary text-white shadow">
        {text}
      </button>
    );
  }
  ```
</CodeGroup>

<Info>
  `.makeswift.ts` is a naming convention for organizing Makeswift registration
  code. [Learn
  more](/developer/reference/runtime/register-component#organizing-registration-code).
</Info>
