[RFC] Overload icon prop to accept ReactElement list for unified DSL
#15
Replies: 3 comments
|
Yeah, I can add an overload. No problem. |
|
Actually, on second thought, I think I'm going to not add overloads for any property that only takes a single If you feel strongly about it, let me know and maybe we can figure out a way to add those |
|
By the way, in the past, this is how I've added said overload: /// WARNING: Tooltip can contain no more than one child element.
/// If you try to use more than one child, only the first you pass to this function will be used.
static member inline children ([<ParamList>] elems: Fable.React.ReactElement seq) =
match elems |> Seq.tryHead with
| Some el -> Interop.mkProperty<ITooltipProp> "children" el
| None -> Interop.mkProperty<ITooltipProp> "children" Html.none |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
As it currently stands, the
x.iconprop accepts either a ReactElement or a list of Properties.There is a common pattern of creating
buncleIconobjects. When used in conjunction withx.icon, we pass a list of properties to the bundleIcon for local styling such as size. Because of these consecutive calls, we then have to explicitly scope the parameters to their function calls:Due to the Feliz DSL, users might expect the following to work too:
This currently hits the overload for parameters and therefore hits an error.
If we introduce an overload such as this, we can incorporate the above DSL with some user caution:
All reactions