question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom input class

See original GitHub issue

Currently there is no way specify custom css classes to be applied to the input element. This makes it inconvenient to integrate the date picker with existing css frameworks, as separate styles must be specified for the datepicker input.

It would be nice if an option were provided to pass custom classes to the input element.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
agm1984commented, Mar 26, 2019

Here’s how I styled the cells on the calendar–had to fight against the hyper-specific inline rules the library outputs in order to change the colours from blue to pink:

    mounted() {
        const specificityHax = `
            .vdp-datepicker__calendar .cell:not(.blank):not(.disabled).year:hover { border: 1px solid ${colors.pink}; }
            .vdp-datepicker__calendar .cell:not(.blank):not(.disabled).month:hover { border: 1px solid ${colors.pink}; }
            .vdp-datepicker__calendar .cell:not(.blank):not(.disabled).day:hover { border: 1px solid ${colors.pink}; }
            .vdp-datepicker__calendar .cell.selected {
                background: none;
                background-color: ${colors['pink-lighter']};
                color: ${colors['black-darker']};
            }
            .vdp-datepicker__calendar .cell.selected:hover {
                background: none;
                background-color: ${colors['pink-lighter']};
                color: ${colors['black-darker']};
            }
        `;

        const style = document.createElement('style');
        if (style.styleSheet) style.styleSheet.cssText = specificityHax;
        else style.appendChild(document.createTextNode(specificityHax));
        document.getElementsByTagName('head')[0].appendChild(style);
    },

This code appends <style> into the document head with those rules. I recommend browsing the styles in your dev tools and override the styles on the same classes they are originally on.

Here is what that code produces: dp1

0reactions
Sammuel09commented, Jun 28, 2020

Hello @DeltaBravo How did you do that? Can you explain or show an example

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap 4 Custom Forms - W3Schools
To create a custom file upload, wrap a container element with a class of .custom-file around the input with type="file". Then add the...
Read more >
Forms - Bootstrap
Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.
Read more >
Custom CSS Styles for Form Inputs and Textareas
Create custom form input and textarea styles that have a near-identical appearance across the top browsers, and ensure all states meet ...
Read more >
How do I add a custom class to a HTML input?
Looking to create a unique identifier on a HTML input to be able to hook up a multi select js function.
Read more >
Custom input types - Vue Formulate
Custom input types. If the input type you're looking for is not part of the built-in fields (mostly HTML5 input types), and you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found