Giter VIP home page Giter VIP logo

Comments (4)

moklick avatar moklick commented on September 16, 2024 2

Hey @agrawal-rohit,

you can overwrite the CSS via:

.react-flow__controls-button {
  width: 16px;
  height: 16px;
}

from react-flow.

rdhara avatar rdhara commented on September 16, 2024 1

@moklick That worked, thank you so much for the quick response! Great library by the way :)

from react-flow.

rdhara avatar rdhara commented on September 16, 2024

Hello, I am having some issues with adding styles on the controls object - even the simpler example above isn't working for me. This is the CSS I am adding

Dag.css:

.react-flow__controls {
    display: flex;
    justify-content: space-between;
    position: absolute;
    z-index: 5;
    top: 20px;
    left: calc(50% - 200px);
    height: 50px;
    width: 400px;
    background-color: white;
    border: 1px solid darkgray;
    border-radius: 5px;
}

.react-flow__controls-button{
    width: 40px;
    height: 40px;
    border: none;
    background-color: white;
    border-radius: 5px;
}

.react-flow__controls-button svg {
    max-height: 20px;
    max-width: 20px;
}

And in my Dag.js file, I import my Dag.module.css for my CSS modules as well as the above Dag.css file.

which when I run npm start in test mode, it appears to be working correctly:
image

But when I deploy a site using npm run build I am getting this:
image

Inlining the styles directly in the Controls and ControlButton is working slightly better, but I am now missing the gray-on-hover effect and can't inline that selector. I suspect this is due to the default and theme styles being injected into <head/> in a different order during the build step than how local mode works. Going for the nocss option seems like overkill since I just want to override a couple styles - I presume I'm doing something wrong here.

I am using CRA, react 18.2, and react-flow-renderer 10.3.14. Thank you in advance!

from react-flow.

moklick avatar moklick commented on September 16, 2024

try to strengthen the selector with .react-flow:

.react-flow .react-flow__controls {
    display: flex;
    justify-content: space-between;
    position: absolute;
    z-index: 5;
    top: 20px;
    left: calc(50% - 200px);
    height: 50px;
    width: 400px;
    background-color: white;
    border: 1px solid darkgray;
    border-radius: 5px;
}

.react-flow .react-flow__controls-button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: white;
    border-radius: 5px;
}

.react-flow .react-flow__controls-button svg {
    max-height: 20px;
    max-width: 20px;
}

Does this work?

from react-flow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.