-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Feature request: exported internal styles #11294
Comments
@ricokahler The
It sounds like a different use case than #11235. |
@oliviertassinari oh my apologies, I was mislead from an error with vscode. It was saying:
I fixed the error by defining and exporting the Should the typings include a definition for Let me know what you think, else I'm good to close the issue. Thank you! |
@ricokahler Yes, I guess. In the long-term, we want to look into #6218. |
import { styles } from '@material-ui/core/Input' In TS, And console.log this styles, it is I'm building custom |
@oliviertassinari |
@artalar The style was moved. You can find it here now: https://github.com/mui-org/material-ui/blob/e167ea5af7f2a71a0ed132d6879cb77892a4b918/packages/material-ui/src/InputBase/InputBase.js#L66 |
What is the use case for having the Our public API is simply that a component looks a certain way using a certain set of classNames. I would not recommend you use these styles for unrelated components since they might break on any release. |
@eps1lon We are using it for generating the markdown classes API. I'm not aware of any valid use case for importing them. I never had one. |
i’m no longer importing styles and i can imagine making styles part of the public API being a hassle so feel free to close this issue. i think my use case was to get the color of the filled text field variant or something like that? doesn’t matter though |
@ricokahler Always try to include a specific use case. While it's tempting to just look into the source and say what you want it makes it very difficult for us to find a good solution. If somebody can provide a concrete use case I'm happy to reopen. I'm closing until then since the author has no use for this anymore. |
Current Behavior/Context
As far as I'm aware (and I could be wrong), there is no way to get to the internal styles object of a component. For example, for
<Input>
s, I'd like to grab theunderline
class and use it in an external custom component.Desired Behavior/Proposal
I'd like to propose that the styles object/function become a property on the component class so that it is available externally.
For example:
Concerns
Exporting the
style
s of a component technically means that changing thestyle
object is a breaking change. Maybe instead ofInput.__styles
could be used instead ofInput.styles
to let devs know it might lead to breaking changes if you didn't want to be strict about it.Let me know what you guys think. I'd like to use the internal styles over copying and pasting.
Thanks for the great library!
The text was updated successfully, but these errors were encountered: