Skip to main content

Text

This prop is used to set the text of the component.

Structure

This prop has 3 required properties:

  • type - The namespace of the prop. \LivewirePageBuilder\Props\Text::class
  • label - The label of the prop. Text
  • default - The default value of the prop. ''

This prop has 1 optional property:

  • rules - The validation rules of the prop. ['nullable', 'string']

This prop will render a text input field in the editor.

Return value

The return value of the prop will be the value of the text input field.

Example

public static function getConfig(): array
{
return [
'name' => __('Custom Component'),
'description' => __('A custom component that can be used to display custom content.'),
'icon' => '/path/to/icon.svg',
'allow_children' => false,
'props' => [
'alt' => [
'type' => \LivewirePageBuilder\Props\Text::class,
'label' => __('Alt Text'),
'default' => '',
'rules' => ['nullable', 'string'],
],
]
];
}