-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend theme*
props to accept functions that receive the default class list
#26
Comments
@kepta helped come up with an adjustment to this that will probably be nice. Since the most common use case for |
I audited our use of
cc @mapbox/frontend |
theme*
Props to accept functions that receive the default class list
theme*
Props to accept functions that receive the default class listtheme*
props to accept functions that receive the default class list
Having experimented with a few different options, here's the outline of a styling pattern that I think could fit our purposes:
variant
,size
, andwidth
props.theme*
props. This is the pattern established by the bulk of existing components and has proven useful. The main problem with it is that it requires a lot of the user — so it makes sense for advanced users, but not for the average user. We should continue to use these but indicate in the docs that they are advanced props and most people should not need to use them.One major annoyance with the
theme*
props is that you need to replace every class that you don't want to override. A common use case is to just append a class to the end of the list, but to do this you actually need to copy-paste the default class list and add your own to the end — and that's not very robust or cheery. So I'm thinking that instead oftheme*
props accepting only strings, they'll also accept functions that receive the default class list and return a modified one. Appending would be very easy, then.cc @danswick
The text was updated successfully, but these errors were encountered: