Skip to content

Consider alternative method of styling toggle buttons (don't use data-toggle="buttons" for styling)  #23728

Description

@pkozlowski-opensource

Ref: https://getbootstrap.com/docs/4.0/components/buttons/#checkbox-and-radio-buttons

As of today we need to add data-toggle="buttons" to get proper styling on check / radio buttons done with inputs + labels. While I totally see how it works perfectly with provided jQuery plugins, it is not very intuitive for people not using jQuery but rather using a framework like Angular or React.

Would you consider another method of styling toggle buttons, for example using a dedicated CSS class (eg. .toggle-buttons)?


I've opened similar issue in the past (#20359) but then closed it as a duplicate of #18874. #18874 in turn got closed as a duplicate of number of other issues without addressing the problem. Hence I'm opening a new issue to start with a "clean slate".

Activity

  1. added
    cssSass sources or compiled CSS
    v4v4, the frozen docs on gh-pages
    on Aug 29, 2017
  2. mdo commented on Aug 29, 2017

    @mdo
    Member

    Yeah, this should be a class. I don't think anything else is done via data attributes?

  3. pkozlowski-opensource commented on Aug 29, 2017

    @pkozlowski-opensource
    Author

    Yeah, this should be a class. I don't think anything else is done via data attributes?

    Nope, I didn't bump into other cases where data-* is needed for pure styling purposes. So apart from this particular case we should be all good!

    For the reference, the data-toggle="buttons" selector is used today in JS plugin (

    DATA_TOGGLE_CARROT : '[data-toggle^="button"]',
    DATA_TOGGLE : '[data-toggle="buttons"]',
    ).

  4. mdo commented on Aug 29, 2017

    @mdo
    Member

    Using it in our JS is fine, but behavior should be detached from styles. That way you can drop our JS and use your own without styling issues.

  5. added
    has-prAn open pull request addresses it
    on Nov 25, 2017
  6. mdo commented on Nov 25, 2017

    @mdo
    Member

    #24733 was merged, so closing.

  7. added a commit that references this issue on Dec 1, 2017
  8. added a commit that references this issue on Dec 8, 2017
  9. added a commit that references this issue on Dec 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cssSass sources or compiled CSShas-prAn open pull request addresses itv4v4, the frozen docs on gh-pages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions