Because Ember doesn't support spreading props like React does, Pluma includes some utilities to help work around this limitation.
All Pluma components in Ember accept an additional argument called unsafe_props.
The argument is an object that may contain any of the component's standard arguments.
Internally, when Pluma components read an argument, they first check if the argument
is provided via standard argument syntax. If it's not available, they check whether
that argument exists in unsafe_props, and use that value if it does.
This way, Pluma components can "spread" props: by passing an object to unsafe_props.
The utilities that support this are exported from Pluma for consumption in Ember apps.
With unsafe_props, it's possible to easily add sprinkle (utility argument) support
to any custom app component.
First, extend your component's signature to include the AllBoxArgs interface,
which contains all the possible Box component arguments. The interface is imported via
Next, import the sprinkleProps utility as follows:
and then use it to define a property in your component class, like so:
This creates a proxy object that we can then pass into a Pluma component's unsafe_props argument.
A complete example might look like the below:
The sprinkles example above works great if all we want is to add support for
sprinkle utilities, most commonly by forwarding them to a PlumaBox component
(though you can also use unsafe_props with other Pluma components).
Sometimes, you may want to extend a different Pluma component, and still support all the arguments that the original component supports.
To do so, you can use the propsProxy utility, which is what Pluma uses internally
in all its components.
For example, this is what extending a PlumaButton might look like: