Skip to main content

ui:prop

Defines a template argument (prop) for a component.

You must use this ViewHelper instead of the standard f:argument ViewHelper to define props for a component. It mirrors the API of f:argument but adds some additional features like exposing the prop to the client hydration data or the context.

Example

<ui:prop name="variant" type="string" optional="{true}" default="primary" />
<ui:prop name="size" type="string" optional="{true}" default="medium" client="{true}" />

Arguments

Name Type Description Required Default
name string name of the template argument Yes -
type string type of the template argument Yes -
description string description of the template argument No -
optional boolean true if the defined argument should be optional No false
default mixed default value for optional argument No -
client boolean Whether the property should be exposed to the client hydration data. See Hydration for more information. No false
context boolean Whether the property should be exposed to the components context. See Context for more information. No false
requiredAtRuntime boolean Whether the property is required at runtime. This means that the component will throw an error if the property is not defined when rendering. This is used internally by the primitives so props spreading works. No false