This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Does Input support inline custom components? #976
Unanswered
HaveSpacesuit
asked this question in
Q&A
Replies: 2 comments
-
|
It looks like using non-jsx gets this to work as I want: |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
The problem here is that your custom component does not take any props. It will work if you forward the props. function MyButton(props: IconButtonProps) {
return (
<IconButton styleType="borderless" {...props}>
<SvgCloseSmall />
</IconButton>
);
}This is because we clone the icon and pass it a In the future we might change the approach to avoid cloning (it is considered bad practice) and instead add a wrapper. That should get rid of this limitation. Hope that helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
You can add a custom button to an input component, but it appears that the layout is messed up if using any custom component. Is this intentional? Is there a way to support it?
https://codesandbox.io/s/itwinui-react-minimal-example-forked-e6ecit?file=/src/App.tsx
Beta Was this translation helpful? Give feedback.
All reactions