#Conditional Default Props in Theme

6 messages · Page 1 of 1 (latest)

lean crane
#

In my app, the mantine Title component needs to have responsive font-size (different sizes at different breakpoints) ONLY when props.size = h1. Is there a way to conditionally set defaultProps in theme.components based on a props value? I see this is possible for styles and classnames using the callback, but it doesn't look like defaultProps accepts a callback. Currently, we are using a css module and a callback for classNames to accomplish this, but we feel it would be cleaner if we could use defaultProps and the provided responsive style props.

jaunty mirage
#

wow I've been wondering the same thing!

viral ibex
jaunty mirage
#

Thank you for your response, @viral ibex

lean crane
#

@viral ibex Thanks!

dawn blaze