Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

feat(): dropdown-toggle rewrite #284

Closed
@shaungrady

Description

@shaungrady

@bekos @pkozlowski-opensource @ajoslin, here's what I'm thinking about for a refactored dropdownToggle directive. First, I'd propose renaming it to simply dropdown. The markup would be very simple:

<button class="dropdown" label="Dropdown Button <span class='caret'></span>">
  <ul>
    <li><a href="#">Do</a></li>
    <li><a href="#">Re</a></li>
    <li class="divider"></li>
    <li><a href="#">Mi</a></li>
  </ul>
</button>

When the dropdown directive is compiled, it would move the ul to the outside of the button (so it's a sibling) and set a style of display: none, then the innerHTML of the button would be set to the label attr.

When the button is clicked, the ul will have the display: none style unset and the button will receive a class of active (could be changed via activeclass attr, or config?)

I think this is a simple and flexible solution, and it's all self-contained. The only downside to this approach is that it assumes the dropdown element is wrapped in a relatively positioned element, e.g., a div.btn-group.

What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions