Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less-specified css selectors for buttons? #5

Closed
gregsabo opened this issue Sep 19, 2013 · 3 comments
Closed

Less-specified css selectors for buttons? #5

gregsabo opened this issue Sep 19, 2013 · 3 comments

Comments

@gregsabo
Copy link

I'd like to use the themes but roll my own markup, but right now the CSS selector for the primary button looks like this:

.vex.vex-theme-default .vex-dialog-form .vex-dialog-buttons .vex-dialog-button.vex-dialog-button-primary

It would be nice to not have to jump through so many hoops.

@adamschwartz
Copy link
Contributor

You can add your own class names to buttons and style them with those selectors.

Check out this example (code) which adds a class to the submit button to make it red.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://github.hubspot.com/vex/js/vex.js"></script>
<script src="http://github.hubspot.com/vex/js/vex.dialog.js"></script>
<link href="http://github.hubspot.com/vex/css/vex.css" rel="stylesheet" />
<link href="http://github.hubspot.com/vex/css/vex-theme-os.css" rel="stylesheet" />
<style>
    .vex .my-button-class-name {
        color: red;
    }
</style>
<script>
    window.onload = function() {
        vex.dialog.alert({
            className: 'vex-theme-os',
            message: 'Like my red button?',
            buttons: [{
                type: 'submit',
                text: 'YES',
                className: 'my-button-class-name'
            }]
        });
    }
</script>

@gregsabo
Copy link
Author

I guess what I mean is, the themes have lots of styling which is compatible with vex.dialog, but they can't be reused for more complex modals using vanilla vex. If I want a primary button on a modal, I need this markup:

<div class="vex-dialog-form">
    <div class='vex-dialog-buttons'>
        <div class="vex-dialog-button vex-dialog-button-primary">OK</div>
    </div>
</div>

I'd prefer only having to do this:

<div class="vex-button-primary">OK</div>

@adamschwartz
Copy link
Contributor

Got it. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants