Allow className for all components
See original GitHub issueIs your feature request related to a problem? Please describe.
I wish to customize & improve some of the primitive components like Checkbox
or Label
to have different look-and-feel. One common example is like the TextInput
with sizing
props to allow user to customize sizing at will. I curious why most components disallow to extend className
?
Describe the solution you’d like
Allow classname
for all components.
Describe alternatives you’ve considered
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:11
Top Results From Across the Web
Passing in class names to react components - Stack Overflow
Shouldn't adding className prop to a React component pass on that className to the first container element instead of passing it as a...
Read more >Passing className to components in React - Daily Dev Tips
In React, we are familiar with the concepts of a className on components. It's the way React adds the class attribute to an...
Read more >Passing className to components in React
In React, we are familiar with the concepts of a className on components. It's the way React adds the class attribute to an...
Read more >Pass class names as props to React components | bobbyhadz
Pass a string containing the class names as a prop. · Destructure the prop in the child component. · Assign the class names...
Read more >Passing classnames as a props to the React component
Now, inside an App component we can pass a classname to the Button component using cname prop. App.js. import React from "react"; import...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But sometime we need to adjust its positioning, padding, margin, etc.? One example is like the below where I wish to align center & provide a little gap between.
I understand there is another way to accomplish the same thing, but I believe there are more cases like this where we need
className
not only to customize its styling but also for us to adjust its positioning.Or if I wish to have my button to be full width
I didn’t tested it. 😃 AFAIK, default Button style is
w-fit
, isn’t? It should have the parent size. If not, it is a bug.