Joe
02/09/2023, 6:32 PMval MyComponent = FC<MyCompontentProps> {
Box {
// content of the component
}
}
external interface MyComponentProps : Props {
var sxProps: SxProps<Theme>?
}
But I don't know what I should do to use it in the following way:
MyComponent {
sx {
width = 50.pct
// etc
}
}
Or am I doing something wrong?turansky
02/10/2023, 12:01 AMJoe
02/10/2023, 8:59 AMexternal interface MyComponentProps : PropsWithSx
And my component with some it's own sx props:
val MyComponent = FC<MyComponentProps> { props ->
Box {
sx {
// call it "inner props"
}
}
}
And I use the component like this:
MyComponent {
sx {
width = 50.pct // call it "outer props"
}
}
But it doesn't work: I do nothing to apply outer props.
I try
val MyComponent = FC<MyComponentProps> { props ->
Box {
sx = <http://props.sx|props.sx>
sx {
// some inner props
}
}
}
But it doesn't work too.val MyComponent = FC<MyComponentProps> { props ->
Box {
sx {
// inner props
<http://+props.sx|+props.sx>
}
}
}
aerialist
02/10/2023, 9:23 AMkotlin-mui-showcase
sample
https://github.com/karakum-team/kotlin-mui-showcase