ui:useProps
Use props from another component.
This ViewHelper allows you to import all props from another component and register them for the current component.
This is helpful/needed when consuming the primitives
components or when you want to reuse props from another component.
Example
Tooltip/Root.html
that uses the tooltip primitive:
<ui:useProps name="primitives:tooltip.root" />
<primitives:tooltip.root spreadProps="{true}">
<f:slot />
</primitives:tooltip.root>
Limitation
Currently its not possible to use this useProps
and spreadProps
pattern with required arguments because of how Fluid parses the templates.
If a prop for a primitive is required, we use the ui:error ViewHelper to manually throw an error if the prop is not set.
Arguments
Name | Type | Description | Required | Default |
---|---|---|---|---|
name |
string | name of component to use the props from | Yes | null |