question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow className for all components

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:11

github_iconTop GitHub Comments

6reactions
leesiongchancommented, Jul 21, 2022

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.

<Label className="inline-flex gap-2 items-center">
  <Checkbox />
  Remember me
</div>

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

<Button className="w-full">Hello World</Button>
1reaction
rluderscommented, Jul 21, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found