TextInput

The TextInput control provides your component a string value that is editable in the Makeswift builder.

AnchorExamples

In this example we register a simple Link component with its children and href props controlled by TextInput controls.

Link text input panels

import { ReactRuntime } from '@makeswift/runtime/react'
import { TextInput } from '@makeswift/runtime/controls'

function Link({ children, href }) {
  return <a href={href}>{children}</a>
}

ReactRuntime.registerComponent(Link, {
  type: 'link',
  label: 'Link',
  props: {
    children: TextInput({ label: 'Text', defaultValue: 'Click me!' }),
    href: TextInput({ label: 'URL', defaultValue: '#' }),
  },
})

AnchorAPI

AnchorParameters

ParameterTypeRequiredDefaultDescription
labelstringno'Text'Text for the panel label.
defaultValuestringnoundefinedWill be used when the value isn't set.

AnchorProvided value

The TextInput control provides a string value to your component—or undefined if there's no value set. Use defaultValue if you never want your component to receive undefined.