Open gretanausedaite opened 1 year ago
Since migrating to iTwinUI 3.x we replaced all our usages of .iui-
class styling in favor of passing className
s into these additional props you provided. So far everything is great, we only noticed that we are missing those:
Tag
component - namely tag text and close button as right now we are using span
and button
css selectors to style them - not sure if its a good solution now.Modal
component - we can utilize ModalContent
and ModalButtonBar
and style them properly - but we still can't style title bar, X close button, modal backdrop and modal wrapper. Modal wrapper especially since sometimes other packages have a higher z-index than Modal component and we have to fight over who gets display priority. Right now we workaround this by having our own modal portal in the root of our application that we can style and use this portal for every single Modal component. So ability to provide more props to Modal would be great - or at least we could have a composable Modal structure like
<Modal.Wrapper>
<Modal.Backdrop/>
<Modal.Box>
...
</Modal.Box>
</Modal.Wrapper>
@Juliakas
- Providing extra props to
Tag
component - namely tag text and close button as right now we are usingspan
andbutton
css selectors to style them - not sure if its a good solution now.
Could you share your use case for customizing Tag
? We can add textProps
and closeButtonProps
, but it should also be fine to do this:
<Tag className='my-tag' />
.my-tag > span {}
.my-tag > button {}
- Providing extra props to
Modal
component - we can utilizeModalContent
andModalButtonBar
and style them properly - but we still can't style title bar, X close button, modal backdrop and modal wrapper. Modal wrapper especially since sometimes other packages have a higher z-index than Modal component and we have to fight over who gets display priority. Right now we workaround this by having our own modal portal in the root of our application that we can style and use this portal for every single Modal component. So ability to provide more props to Modal would be great - or at least we could have a composable Modal structure like
We could add extra props to Modal
, but I'm not sure if we would expose subcomponents. Modal
is just a wrapper around Dialog
, so you can use Dialog
directly with the same set of props Modal
uses. Take a look at Modal.tsx
, it's quite simple.
we workaround this by having our own modal portal in the root of our application that we can style and use this portal for every single Modal component.
I just want to mention that this is not a workaround. Adding a z-index is the workaround. Portaling is the proper way to avoid z-index issues.
To avoid repetition you can create a wrapper component, or use the portalContainer
prop in iTwinUI's ThemeProvider
to affect all floating elements.
@mayank99
Could you share your use case for customizing Tag? We can add textProps and closeButtonProps, but it should also be fine to do this:
We are currently doing this, if that is a valid usage then we should be good (provided internal html structure wont change to impact those selectors). Our use case is removing user-select
and changing other text css properties as we made our tags clickable (we don't want text selection if we click on tag). Also we changed colors for close button and text as we made tags have accent style (when selected).
We could add extra props to Modal, but I'm not sure if we would expose subcomponents Modal is just a wrapper around Dialog
Looked into Modal source so it seems Dialog is all we need then. I thought these 2 components were a separate thing lol. Just have to test to make sure, but I guess we have everything we need 👍
Thanks for bringing this to our attention. I noticed this issue is a few months old and has some resolved comments on it. I'll go through the customizable elements to double check if this issue has been taken care of.
The goal is to allow adding a custom
className
(or data attribute) to every single dom node. For example: it should be possible to add a custom class to Button text, Checkbox wrapper, etc.To do:
wrapperProps
in Checkbox.Example usage from a consumer-perspective:
Status
High Priority:
Mid Priority:
Fieldset: Nothing to changeSurfaceIs only one element / has subcomponents.Low Priority:
Avatar: Is only one element.BlockQuote: Not needed /footer
has nothing special.Carousel: Already has subcomponents.Input: Is only one element.Search Box: Already has subcomponents.