gitlab-org--gitlab-foss/doc/development/fe_guide/components.md

41 lines
902 B
Markdown
Raw Normal View History

2018-02-14 04:16:04 -05:00
# Components
## Contents
- [Dropdowns](#dropdowns)
2018-02-14 04:16:04 -05:00
## Dropdowns
See also the [corresponding UX guide](https://design.gitlab.com/#/components/dropdowns).
2018-02-14 04:16:04 -05:00
### How to style a bootstrap dropdown
2018-02-14 04:16:04 -05:00
1. Use the HTML structure provided by the [docs][bootstrap-dropdowns]
1. Add a specific class to the top level `.dropdown` element
```Haml
.dropdown.my-dropdown
%button{ type: 'button', data: { toggle: 'dropdown' }, 'aria-haspopup': true, 'aria-expanded': false }
%span.dropdown-toggle-text
Toggle Dropdown
= icon('chevron-down')
%ul.dropdown-menu
%li
%a
item!
```
Or use the helpers
```Haml
.dropdown.my-dropdown
= dropdown_toggle('Toogle!', { toggle: 'dropdown' })
= dropdown_content
%li
%a
item!
```
2018-02-14 04:16:04 -05:00
[bootstrap-dropdowns]: https://getbootstrap.com/docs/3.3/javascript/#dropdowns