GithubHelp home page GithubHelp logo

Disable Default Styles? about react-modal HOT 16 CLOSED

idmontie avatar idmontie commented on May 1, 2024 8
Disable Default Styles?

from react-modal.

Comments (16)

claydiffrient avatar claydiffrient commented on May 1, 2024 6

v1.0.0 was just published and classnames can override defaults now.

from react-modal.

claydiffrient avatar claydiffrient commented on May 1, 2024 4

@dzmitry-kremez-itechart I'm working on finalizing a few details with the new release. It will happen soon, hopefully this week.

from react-modal.

idmontie avatar idmontie commented on May 1, 2024 2

@ericsoco It would be useful to have that in the docs, but it is quite annoying to have to override every single property for the content and the background if I want to use classes.

from react-modal.

mjyoung avatar mjyoung commented on May 1, 2024

+1 this would be very useful. I would like to just position the elements using flexbox properties.

from react-modal.

ericsoco avatar ericsoco commented on May 1, 2024

I was about to create an issue for the same thing. Only, I was going to create the issue as a suggestion to add this to docs:

To disable the default styles, specify null for each value to disable. This is useful for styling via a stylesheet instead of using inline styles. For example:

modalStyles = {
    content: {
        background: null
    {
};

This works -- any style set to null will not be written to the DOM element, and so can easily be specified with a stylesheet instead.

from react-modal.

Josh-a-e avatar Josh-a-e commented on May 1, 2024

I'd love to see this, at the moment as a temp fix I have all the relevant styles set to null individually

On 12 Nov 2015, at 19:11, Eric Socolofsky [email protected] wrote:

I was about to create an issue for the same thing. Only, I was going to create the issue as a suggestion to add this to docs:

To disable the default styles, specify null for each value to disable. This is useful for styling via a stylesheet instead of using inline styles. For example:

modalStyles = {
content: {
background: null
{
};

Reply to this email directly or view it on GitHub.

from react-modal.

mjyoung avatar mjyoung commented on May 1, 2024

Yep, @ericsoco's workaround worked for me.

If anyone's interested, these are the styles I'm using to have flexbox position the modal::
https://gist.github.com/mjyoung/c10ed08eefcf2e1d5afc

from react-modal.

ericsoco avatar ericsoco commented on May 1, 2024

@idmontie agreed. I have this in my code now:

        modalStyle = {
            overlay : {
                backgroundColor: null
            },
            content : {
                top: null,
                left: null,
                right: null,
                bottom: null,
                border: null,
                background: null,
                borderRadius: null,
                padding: null,
                position: null
            }
        };

And that's a little ridiculous.

from react-modal.

grahamb avatar grahamb commented on May 1, 2024

I just ran into this while updating a project from 0.2 to 0.6.1. @ericsoco's workaround works, but is pretty gross.

#100 looks like it'll fix it.

from react-modal.

hnq90 avatar hnq90 commented on May 1, 2024

We should write:

content: {
  top: 'initial',
  left: 'initial,
   ....
}

from react-modal.

sjungwirth avatar sjungwirth commented on May 1, 2024

And that's a little ridiculous.

agreed

from react-modal.

ffigiel avatar ffigiel commented on May 1, 2024

@ericsoco 👍 I can't understand why defaults are enforced like this

from react-modal.

pjnovas avatar pjnovas commented on May 1, 2024

+1

from react-modal.

wavded avatar wavded commented on May 1, 2024

Just opened another issue but then saw this one that is basically asking the same question. Having to turn off every style seems a little ridiculous and can be breaking if new "default" styles are added. Would prefer to just turn them off and work within CSS.

from react-modal.

dzmitry-kremez-itechart avatar dzmitry-kremez-itechart commented on May 1, 2024

+1 Also as I see here https://github.com/reactjs/react-modal/blob/master/lib/components/ModalPortal.js#L183 you disable default styles if there are class names. But it doesn't work in latest(0.6.1) npm and bower lib version. Could you please publish latest master code to npm and bower?

from react-modal.

dzmitry-kremez-itechart avatar dzmitry-kremez-itechart commented on May 1, 2024

@claydiffrient cool, thx

from react-modal.

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.