TextInput
The TextInput
control provides your component a string
value that is editable in the Makeswift
builder.
AnchorExamples
AnchorA simple link
In this example we register a simple Link
component with its children
and href
props
controlled by TextInput
controls.
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
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
label | string | no | 'Text' | Text for the panel label. |
defaultValue | string | no | undefined | Will 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
.