diff --git a/packages/material/src/Button/Button.tsx b/packages/material/src/Button/Button.tsx index d3be98ded..d38673bf0 100644 --- a/packages/material/src/Button/Button.tsx +++ b/packages/material/src/Button/Button.tsx @@ -8,7 +8,7 @@ import createComponentFactory from "@suid/base/createComponentFactory"; import { alpha } from "@suid/system"; import { InPropsOf } from "@suid/types"; import clsx from "clsx"; -import { Show, useContext } from "solid-js"; +import { children, Show, useContext } from "solid-js"; type OwnerState = InPropsOf; @@ -339,6 +339,8 @@ const Button = $.component(function Button({ classes, }) { const contextProps = useContext(ButtonGroupContext); + const startIcon = children(() => props.startIcon); + const endIcon = children(() => props.endIcon); return ( - + {(startIcon) => ( - {startIcon()()} + {startIcon()} )} {props.children} - + {(endIcon) => ( - {endIcon()()} + {endIcon()} )} diff --git a/packages/material/src/Button/ButtonProps.ts b/packages/material/src/Button/ButtonProps.ts index 334f90247..477b228c5 100644 --- a/packages/material/src/Button/ButtonProps.ts +++ b/packages/material/src/Button/ButtonProps.ts @@ -69,7 +69,7 @@ export type ButtonTypeMap

= { /** * Element placed after the children. */ - endIcon?: () => JSXElement; + endIcon?: JSXElement; /** * If `true`, the button will take up the full width of its container. * @default false @@ -92,7 +92,7 @@ export type ButtonTypeMap

= { /** * Element placed before the children. */ - startIcon?: () => JSXElement; + startIcon?: JSXElement; /** * The system prop that allows defining system overrides as well as additional CSS styles. */