All Questions
10,012
questions with no upvoted or accepted answers
11
votes
0
answers
641
views
AMP style amp-custom returns empty on HTML; results in validation error
I'm using AMP on NextJs and am trying to insert in my head tag. I managed to get it into the head tag but the rendered html returns an empty
<style amp-custom></style>
and instead ...
11
votes
4
answers
7k
views
How to import .scss files anywhere in Next.js app?
I want to convert pure React app to NextJs app. In React app I'm importing .scss CSS files in multiple places of components.
Once I move the code into Next.js environment it is showing error:
Gobal ...
10
votes
0
answers
19k
views
How to get colspan=2 in grid css layout?
In my react component I am trying (first time) to use a css grid layout. The column should span 2 but it is only 1:
< Value textAlign="right" gridCol={1} gridRow={index + 3} weight={'regular'}&...
10
votes
1
answer
4k
views
React-Stripe-Elements element not rendering style as expected
I'm trying to setup React-Stripe-Elements and while I was able to get the basic form to render, it does so in a really funky looking way. I even tried to add CSS from a form I found online and it won'...
10
votes
2
answers
5k
views
Apply a class in a Framer Motion tag, animate or initial prop
How do I use a Framer Motion tag, and in the animate and initial props, Apply a class.
Like so.
<motion.div
initial={{ className: 'hidden' }}
animate={{ className: 'visible' }}
>
<div&...
9
votes
2
answers
3k
views
Next.js only loads global.css after manual page refresh. Another also existing styles.js is ignored
As of now the styling happens in two places: global.css + index.js via styled-components
Problem
After start or restart of local server + manual page refresh, all styles are applied as intended. Also ...
9
votes
0
answers
4k
views
You forgot to add 'mini-css-extract-plugin' plugin
I'm using mini-css-extract-plugin in my webpack, version 1.3.6 but when trying to run dev build getting the below error. css and scss both are in the app.
ERROR in ./src/index.css
Module build failed (...
9
votes
0
answers
1k
views
React-beautiful-dnd: Prevent page from scrolling when draggable is being dragged near edge of page
I'm using react-beautiful-dnd in a project and when I'm dragging a draggable, the page auto scrolls if I drag it near the top, bottom or sides of the page. I could theoretically fix this problem by ...
9
votes
2
answers
5k
views
ag-grid webpack css not making to the website
I am using ag-grid in my react app, cannot make the css work with webpack.
grid is looking like this
image:
const path = require("path");
var webpack = require("webpack");
let HtmlWebpackPlugin = ...
9
votes
1
answer
2k
views
Using mixins in material-ui to customize components in React
I am trying to customize a textfield component in Material-ui with React.
According information from this page:
To customize the colors of any part of the text-field, use the following mixins. We ...
9
votes
1
answer
3k
views
In MUI v5, how do you debug/find a specific element/style/class in the dev tools DOM?
In MUI v4, it's very easy to inspect the DOM and isolate the exact component file and style block within that file:
MUI v4 way of finding a specific element/style class
However, in MUI v5, this is not ...
8
votes
0
answers
2k
views
Change Color flowbite-react Tabs Component (Next js)
Hi can anyone help me on how to change the color of tabs in flowbite-react component, I'm using Next js. I already setup as per doc here https://flowbite.com/docs/getting-started/next-js/
Also I ...
8
votes
3
answers
1k
views
How to prevent nearby text selection when pressing and holding a button on mobile?
I have an application where a user needs to press and hold a button to record audio. However, when a user holds the button on mobile, the browser tries to select nearby text (since the user is holding ...
8
votes
1
answer
3k
views
Not able to import css files in react
In App.js I wanted to import App.css file or any css file. import './App.css' is not working here and giving error " ERROR in ./src/shared/App.css 1:0
Module parse failed: Unexpected token (1:0)
...
8
votes
1
answer
457
views
How to get warnings on undefined CSS variables
Trying to use CSS variables for the first time. Doing it in a react (create-react-app) application, and works great. Only issue is that there's no warnings if I mistype a variable name or just simply ...
8
votes
1
answer
6k
views
Closing a react bootstrap modal with escape key
I have 6 buttons which, when clicked, activate a modal. This is written in React.
//Since I have 6 different modals, giving each of them an id would distinguish them
onCloseModal(id) {
this....
7
votes
1
answer
2k
views
Slider does not work in react-slick with typescript
I am using the typescript version (@types/react-slick) of the react-slick library to implement carousel/slider in a Nextjs project. I am getting the following error after importing the Slider ...
7
votes
4
answers
9k
views
Open and Close Dropdown menu on by mouse hover in react js
I am new to React JS.
My problem is that I want the menu to disappear if the mouse leaves that area, so I tried onMouseOut and onMouseLeave to close the menu but it seems that when this option is ...
7
votes
0
answers
2k
views
ReactJS - Refused to apply inline style because it violates the following Content Security Policy directive
I get the following error in the browser inspector (Chrome, Brave, Safari) when I load my ReactJS project in Production:
Refused to apply inline style because it violates the following Content ...
7
votes
2
answers
10k
views
'outlined' not working in Material UI Select
I am implementing Material UI `Select' for which values are coming from backend. Below is my code
<FormControl variant="outlined" className={classes.formControl}>
<InputLabel ref={...
7
votes
1
answer
3k
views
Importing CSS from node_modules with Parcel
I am currently migrating as React project built with Webpack into Parcel as an experiment to see what the hype is all about. The project uses Reactstrap, which has Bootstrap as a dependency.
I have a ...
7
votes
2
answers
6k
views
Bottom Fixed div getting pushed up with android keyboard
I have a fixed div at the bottom, but in response view, in android, it gets pushed up with the keyboard.
const ContactBackgroundImage = styled.div`
color: white
padding: 50px
height: 118px
...
7
votes
0
answers
1k
views
Compilation Failure when Making a Production Build with create-react-app v2
Creating an optimized production build...
Failed to compile.
Lexical error on line 1: Unrecognized text.
Erroneous area:
1: $progress-size - 2 * $border-size
^..^
I encounter the above compilation ...
7
votes
0
answers
7k
views
Properly pushing a Canvas with Material UI Persistent Drawers
I have an application with two expandable toolbars. The left toolbar functions as intended, but I have not been able to make the right toolbar push the content properly. See the code below.
I copied ...
7
votes
1
answer
3k
views
Keeping sticky positioning behaviour when sticky elements are inside a container (because of React having to render a single parent element)
I have a top section above some main content.
The top section comprises 5 parts: a 'main header', 3 'categories', and 'settings'.
Given the user scrolls down the page, the 'main header' stays sticky ...
7
votes
3
answers
2k
views
Link stylesheet with media query to React component
In an html file it is possible to link stylesheets like this:
<link rel="stylesheet" media="(min-width: 768px)" href="small.css">
<link rel="stylesheet" media="(min-width: 1150px)" ...
7
votes
1
answer
3k
views
Using css-loader inline with Webpack + React
I'm building my React app with Webpack, and css-loader w/modules. I love it. Most of my stylesheets are very small, though, and I'd like to inline them within the same JSX file as my markup and ...
6
votes
0
answers
737
views
Virtual keyboard in Safari causes black space under app body and scrolling outside of it
I'm creating a chatbot app in React. It works fine on other browsers but on Safari whenever the virtual keyboard is open it causes the entire body to become draggable, the scrollbar extends way below ...
6
votes
2
answers
1k
views
javascript - How to start update scroll percentage when element is on the top of viewport
When entering the website, this is the first UI you'll see.
Then, if you scroll down to the very beginning of section B
I expect the section B will become sticky and the currentPercentage state will ...
6
votes
4
answers
3k
views
Make Tailwind Classes non-Global (automatically!)
I have an application made up of two parts:
(A) legacy application (AngularJs) with its own CSS classes.
(B) div containing a completely new application (React). B is built with webpack, postcss and ...
6
votes
1
answer
2k
views
How to split tailwind css generated code into different directories?
im new to tailwind-css and what i want to achieve is that lets say im using few classes of tailwindcss in component/index.js and i want to generate index.css file of tailwindcss in component directory ...
6
votes
0
answers
446
views
React native KeyboardAvoidingView and ScrollView won't marginTop auto
so I have this layout. I backgrounded in blue the scrollview so I could see how big it is in terms of height.
my goal is to put this button at the end of the page. when the keyboard lifts up, it ...
6
votes
1
answer
717
views
Opacity transition affecting child with backdrop-filter
I am trying to run a transition when entering the viewport. I want the cards to simply opacity in... I have a proxy element inside my div with backdrop-filters applied to apply a "frosted glass&...
6
votes
1
answer
5k
views
CSS Styling Pie Chart / Doughnut chart
I'm using Recharts to try to accomplish a doughnut chart with rounded segments, which should end by looking more or less like this:
This is the closest I can achieve, but as you can see I'm running ...
6
votes
0
answers
2k
views
CSS Modules in React - solutions to share reusable code
I am migrating global SASS in my project that was a mix of global scss and some sort of custom bootstrap-like framework into SCSS Modules.
I have global styles reference everywhere in the app that ...
6
votes
0
answers
1k
views
Split text across DIN A4 pages
I'm working on creating an editor using DIN A4 pages with specific text formatting using React.
Right now, my content is handled by an editable div (with more divs nested inside it for formatting).
...
6
votes
0
answers
130
views
How do I prevent layouts from pushing up when soft keyboard is shown in mobile browsers?
I am trying to have a fixed image in the background that does not move when the soft keyboard is shown. Every time I trigger the soft keyboard,
the whole image scrunches up. How do I prevent that ?
...
6
votes
0
answers
328
views
Trying to switch focus to another input field but browser automatically focuses "first" input field in form (Safari only)
My React web app is forcing focus to the first input field in a form even if I actively change it with my mouse (I can switch input fields by tabbing though).
So I've tried debugging just to find out ...
6
votes
0
answers
1k
views
Create React App creates *.chunk.css when I want them as inline style tag
I'm using CRA2 for building my project. There are some places with css import, like
import 'common.css'
or library csses, like
import 'librabry/dist/lib.min.css'
I want them to be included as ...
6
votes
0
answers
1k
views
The CSS file loading issue in a mobile safari browser
I created the website by using reactJs, nodeJs (express server). Customers are happy and so on but ... there is the issue which is reproducible by a few customers (I can't reproduce it). It seems this ...
6
votes
2
answers
4k
views
Importing CSS variables into a Typescript file
We created a theme.css :root file with a number of commonly used variables to use across the various other .css files for our app.
But some of our older code has a similar setup, but in a theme.ts ...
6
votes
0
answers
1k
views
Building React component library: how to bundle css and other assets?
So my understanding is that when you are distributing a React component for others to use, you should ship the compiled version of it, rather than the source and expecting the end-user to deal with ...
6
votes
2
answers
3k
views
How to wrap too long title in DropdownButton from react-bootstrap?
I have a dropdown button, however, its (dynamically changed) title may be too long to fit. Thus, I am wondering whether there is a way to automatically wrap the too long title to the 2nd line?
<...
6
votes
0
answers
6k
views
How to set width and height to 100% with <AutoSizer>?
I following the example: demo, source code.
they set width={width} and height={height}, if I do that I get nothing displayed... To display somehthing I need to set the height to something, for exaple ...
6
votes
1
answer
3k
views
Semantic UI Vertical Align Icon and Menu
I am currently trying to align a Icon and a text in a Menu.Item with Semantic UI React V.0.68.2.
Currently my HTML output looks like this:
<a class="active item pointer">
<i aria-hidden=...
6
votes
0
answers
871
views
Which is the easiest way to inject markup into an iframe with react?
I'm using react to build an app that will allow the end user to enter their own html/css and I wanted to isolate their code from the main app via an iframe (yes i know saving markup to the database is ...
5
votes
1
answer
2k
views
Tailwind Inline color decorators are not working with CSS variables
I am using Tailwind CSS with CSS variables for styling in my Next 13 project. What I noticed is that the color previewers/decorators that appear when you define a color are not appearing in my class ...
5
votes
0
answers
1k
views
How to use the same background color as a Paper component in Material-UI (dark mode + elevation)
Issue
I am trying to create a custom Tab component using the styled method and I want my custom Tab to use the same background as a Paper with an elevation of 1.
I have an app that allows light and ...
5
votes
0
answers
2k
views
why css is not work corectly on vite lib mode?
I want to create a new npm package and I have a problem with vite lib mode.
I want my package to export some UI components that has some styles, project works fine on yarn dev but when I build it the ...
5
votes
0
answers
2k
views
How to see the full css code in data-styled="active" on a react website
i went to this site which is a react website in there i tried to find the css file it showed me
<style data-styled="active" data-styled-version="5.2.1"></style> how can ...