Questions tagged [class-names]
86 questions
4
votes
1 answer
React - using classNames with imported css
I'm using react and I found this awesome library that helps you define css classes for components called classNames.
I'm also using the webpack css-loader in order to import css into my component and when trying to use classNames with import css I…

Golan Kiviti
- 3,895
- 7
- 38
- 63
2
votes
2 answers
What's the name for a class that simply contains mixins?
Is there a name for a class that simply acts as a holder for mixins?
A simple example in C++ would look like this:
template
class WhatsMyName : Mixins... {
};
WhatsMyName doesn't have any functionality of its own, and is just a…

Casey Rodarmor
- 14,878
- 5
- 30
- 33
2
votes
1 answer
Using classnames with purgecss
I am using classnames with purgeCSS and Webpack.
Apparently PurgeCSS can't handle those classnames itself.
How can I implement an extractor that filters classnames defined in the classnames() function?
my webpack.config.js is in the answers as I…

Bastian Fießinger
- 335
- 3
- 10
2
votes
0 answers
Material UI: Conditional class names not having any effect using classnames library
I am trying to conditionally render class names using classnames npm library and in the DOM it seems they are getting added but I am unable to see the CSS effects behind those classes. I am mainly trying to change the border conditonally.
Below are…

Rajat Bansal
- 315
- 3
- 15
2
votes
1 answer
Using classnames to dynamically style component with CSS based on props value
I am creating a set of reusable components (wrapped material-ui) which are being styled using CSS. I need to set the width of the component dynamically via a prop passed into the custom button.
I want to use classnames to merge the const root style…

tmc
- 404
- 1
- 7
- 20
2
votes
0 answers
Browser javascript output doesn't show classname (unlike Node)
Нello! I have the following short bit of javascript:
let DynamicallyNamedClass = className => {
let F = function() {
this.v = 'hi';
};
Object.defineProperty(F, 'name', { value: className });
return F;
};
let AmazingClass =…

Gershom Maes
- 7,358
- 2
- 35
- 55
2
votes
2 answers
Java - class name starts with numbers
I have done my HW already but our instructor wants us to submit our HWs as yourID_BFS_DFS.java. And I can't do that, it returns error. I know that numbers are not Java letters and it is illegal (I checked other answers already) but still I want to…

WhoCares
- 225
- 1
- 5
- 16
2
votes
1 answer
Use class name to access static variables
Is there a way to access a class variable without explicitly using the class name, in case I decided to change the name of the class later on?
Something like this
static_variable = 'stuff'
className = CLASS
def method (self):
…

Rethipher
- 336
- 1
- 14
2
votes
1 answer
How to handle acronyms in class names?
Instead of explaning I'll provide a simple and short example:
I would call a class that parses XMLs XMLParser. Sometime I run into problems,
e.g. I want to create a class that labels XMLs, but XMLLabeler seems kind of odd, because of the two same…

mike
- 4,929
- 4
- 40
- 80
2
votes
1 answer
How to get class name from package name in android?
I want to make a list of both installed and system applications separately.Below is my code
List appList = packageManager.getInstalledApplications(0);
if(appList != null && !appList.isEmpty()){
for (ApplicationInfo appInfo :…

Devu Soman
- 2,246
- 13
- 36
- 57
1
vote
1 answer
Sonar and Flex plugin - Dollars ($) are not accepted in java class names
In reference to this bug from Sonar:
http://jira.codehaus.org/browse/SONAR-1865
and this one (which cross references the one above):
http://jira.codehaus.org/browse/SONAR-1637
I am still seeing this issue.
I am using Sonar server version 2.12.
I am…

742626
- 23
- 3
1
vote
1 answer
Tailwind custom color is not working in classNames
Set up tailwind.config.js as follows to specify custom colours.
theme: {
extend: {
colors: {
"text-gray": "#747474", Works on its own.
"text-black": "#212121", Works on its own.
"text-black2": "#212121", dummy…

ibij
- 41
- 1
- 2
1
vote
1 answer
what is alternative of .attrs in material ui 5 with styled-components as styled-engine
This is how we add className to a styled-component
import styled from 'styled-components';
export const FieldsColumnWrapper = styled.div.attrs({
className: 'components-list column',
})`
grid-area: components-list;
display: flex;
`
We can use…

Akshay Vijay Jain
- 13,461
- 8
- 60
- 73
1
vote
2 answers
Adding class to result element when submitting form [React.js]
created a simple BMI calculator using React.js. Now I am trying to make it so if the result is anything other than healthy BMI the result text will be colored red (I am using styled-components). I'm struggling to figure out where I should attempt to…

Gosia Ras
- 15
- 5
1
vote
1 answer
Remove / add classname from a HTML elements using React hooks
I'm trying to remove an attripute from html element using on click on a button:
import React , {useState} from 'react';
import classNames from 'classnames';
function App () {
const [isActive, setIsActive] = useState(false);
const…

DirWolf
- 871
- 6
- 22