Skip to main content

Number

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

Structure

This prop has 3 required properties:

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

This prop has 1 optional property:

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

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

Return value

The return value of the prop will be the value of the number 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' => [
'number' => [
'type' => \LivewirePageBuilder\Props\Number::class,
'label' => __('Number'),
'default' => 0,
'rules' => ['nullable', 'numeric'],
],
]
];
}